Reputation: 40951
I have a typical artist has_many songs model and I'm trying to set up the nested resource in Rails.
My routes.rb looks like this:
map.resources :artists do |artist|
map.resources :songs
end
This works fine for the artist paths, but when I want to link to the songs controller, like this:
<%= link_to artist.name, artist_songs_path(artist) %>
my links look like this:
/songs.<artist:0x22b77ec>
Where it should probably look like /artist/5/songs
I'm sure it's something stupid I've missed, but I don't see it. Ideas?
Upvotes: 2
Views: 896
Reputation: 14485
Ummm.... I think you should change map.resources :songs to artist.resources :songs...
Yes. leave the answer around. Maybe retag it with rails routes mistakes...
Upvotes: 1