Excerpts from Linus Pettersson's message of Mon Mar 21 03:40:43 -0700 2011:
> Any ideas anyone?
> 
> I tried this:
> 
> match 'ackord/:artist_id/:id' => 'songs#show', :as => :song
> 
>   resources :artists, :path => "ackord" do
>     resources :songs
>   end
> 
> Which makes it work without the /songs/ part in the url at least for
> the show action. It still works with the /song/ part though, which I
> don't want. Duplicate urls are not good :)
> 
> Also, I have to create a match for each action with this approach. Is
> there a better way to do this?

  # config/routes.rb
  resources :artists, :path => 'ackord' do
    resources :songs, :path => ''
  end

  # rake routes
  …
  artist_song GET    /ackord/:artist_id/:id(.:format)      {:action=>"show", 
:controller=>"songs"}

Does this work for you Linus?
-- 
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