Question

I have a resource called Entries, which has all the normal default RESTful routes that go along with a resource. I want to leave all the routes as they are EXCEPT I want the show action to be rerouted to my Articles controller (Articles#show). Here is my current (but not working) code in my routes file:

resources :entries do
    member do
      get 'entry' => 'articles#show'
    end
  end

Any ideas on how to solve this problem? I want to leave all the other routes from the Entries resource exactly as they are.

Was it helpful?

Solution

I think you should add a match before the resource articles. If I understand, you want the route /entries/1/entry to go to the articles show? Else just change the match line with what you want.

match "entries/:id/entry" => "articles#show"

resources :articles
resources :entries
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top