0

How to use nested resources

Error:

No route matches {:controller=>"documents"}

Code:

<%= link_to "Documentos", school_documents_path(@school)

Routes:

resources :schools do
   resources :documents, :only => [:index]
   resources :tasks, :only => [:index]
end 

DocumentsController:

class DocumentsController < ApplicationController
  def index
  end
end

What is the error?

1
  • your code looks alright. As far as I can see, it should work. What does rake routes say? And are you absolutely sure that the error occurs on the line you say it does? Commented Dec 11, 2010 at 17:28

2 Answers 2

1

Restart application :)

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

Comments

0

this might be a typo but are you missing the end from your index method?

1 Comment

It seems I just needed to restart the rails app. :)

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.