【发布时间】:2011-02-12 16:01:49
【问题描述】:
问题
form_for 帮助程序错误地确定了命名空间内嵌套资源的路径。有问题的模型分别是:Forum::Thread 和 Forum::Reply,位于我的模型目录下名为“forum”的子文件夹中。这是在 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
...
错误
undefined method `forum_thread_forum_replies_path'
参考上面在 _form.html.haml 中概述的行
【问题讨论】:
标签: ruby-on-rails namespaces ruby-on-rails-3 form-for