0

I have a nested resources but i am not get a path for these resources.

routes.rb

namespace :admin do
   resources :demos do
      resources :demojobs, :path => "jobs" do
        resources :demotutorials 
      end  
    end
end

I have try to get the new page of demotutorials page using following link:

new_admin_demo_demojob_demotutorials_path

but getting error

No route matches {:action=>"new", :controller=>"admin/demotutorials"}

working with rails version : 3.2.11

2
  • can you post your controller path and directory of demotutorials_controller.rb file Commented Dec 22, 2018 at 7:32
  • 1
    You can check the names of the generated routes using the command rake routes on a terminal. Anyway, that many nested levels is not a good practice, check the docs guides.rubyonrails.org/routing.html#limits-to-nesting Commented Dec 22, 2018 at 18:13

2 Answers 2

2

I think you have a redundant s at the end of your path, should probably be new_admin_demo_demojob_demotutorial_path instead of new_admin_demo_demojob_demotutorials_path. You can check that by running rake routes in terminal.

Sign up to request clarification or add additional context in comments.

Comments

1

Once try like this,

demotutorials_url(1,2,3) 

if it doesn't work check this link, However, what I've read from ROR guides is

Resources should never be nested more than 1 level deep.

http://weblog.jamisbuck.org/2007/2/5/nesting-resources

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.