Nested resources in namespace form_for
Posted
by Nelson LaQuet
on Stack Overflow
See other posts from Stack Overflow
or by Nelson LaQuet
Published on 2010-04-27T00:56:22Z
Indexed on
2010/04/27
1:03 UTC
Read the original article
Hit count: 415
Problem
The form_for helper incorrectly determines the path to my nested resource inside of a namespace. The models in question are: Forum::Thread and Forum::Reply respectively, located in a subfolder called "forum" under my models directory. This is in Rails 3 BETA 3.
routes.rb
namespace :forum do
root :to => 'threads#index'
resources :threads do
resources :replies
end
end
app/views/forum/replies/_form.html.haml
...
- form_for [@thread, @reply] do |f|
...
app/controllers/forum/replies_controller.rb
...
def new
@reply = Forum::Reply.new
end
...
Error
undefined method `forum_thread_forum_replies_path'
In reference to the line outlined above in _form.html.haml
© Stack Overflow or respective owner