Antonio,
I agree that doing something like "edit_post_asset_path(@event,
@movie) is nice.  But, again, you don't need to put syntax on routes
to achieve nearly the same effect.  As one example, consider the
ResourcesController (RC) plugin which provides helpers like...

edit_resource_path

The identified resources is @movie, the enclosing_resource is @post
and the edit_resource_path expands to edit_post_movie_path(@post,
@movie) automatically.  So the url helper syntax is cleaner and
shorter than your example.

All WITHOUT ANY SYNTAX BURDEN in routes.rb.

*****I think most of the objectives of this ticket are worthwhile but
I can't agree that you need to burden the routes with the syntax.  RC
is but one example of how to solve the problem cleanly.


On Mar 7, 4:48 am, Antonio Tapiador del Dujo <[EMAIL PROTECTED]>
wrote:
> El Wednesday 27 February 2008 18:39:08 wildchild escribió:
>
> >http://dev.rubyonrails.org/ticket/11031
>
> > This patch adds a new option to map.resources named :polymorphic,
> > which will attach a :type requirement to the generated route. It keeps
> > URLs absolutely clean.
>
> Useful for me!
> I'm already using this in my CMSpluginhttp://cmsplugin.rubyforge.org/
>
> > Simple example:
>
> > map.resources :posts, :polymorphic => [:events, :articles] do |posts|
> >   posts.resources :assets, :polymorphic => [:images, :movies]
> > end
>
> > edit_post_asset_path(:post_type => 'events', :post_id => 1, :type =>
> > 'movies', :id => 2)
>
> Even cooler if we could do:
> edit_post_asset_path(@event, @movie)
>
> > => "/events/1/movies/2/edit"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to