Excerpts from Linus Pettersson's message of Mon Mar 21 08:37:33 -0700 2011:
> Hi and thank you for your reply!
> 
> It kinda works... There is some issues though.
> 
> When I go to  .../ackord/artist-name I want to load the artists show
> action and inside this I loop out all the songs that's related to the
> artist.
> 
> When I go to this url now it load the songs index action instead. Its
> because I have these two in my routes
> 
> artist_songs GET    /ackord/:artist_id(.:format)
> {:action=>"index", :controller=>"songs"}
> and
> artist GET    /ackord/:id(.:format)
> {:action=>"show", :controller=>"artists"}
> 
> 
> Perhaps this is actually better and instead of showing the songs
> inside artist#show I filter the songs and show them in songs#index
> instead.

Personally I think it's fine for this logic to live in the songs controller,
especially given that you've effectively namespaced the songs (by artist) by
making it a nested resource.

That said, there is a bit of an ugliness in the route collision, especially
since rails presumably doesn't guarantee the how the collision is resolved.

OTOH there's a lot of ugliness in having to specify each route manually.  Unless
someone else on the list has a better suggestion than the one I offered, you may
have to simply pick your poison.

-- 
med vänlig hälsning
David J. Hamilton

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to