这个问题看起来很简单,但我似乎无法解决它。我一定遗漏了一些明显的东西,但非常感谢任何帮助!
出现的错误信息:
undefined method `discussions_path' for #<#<Class:0x000001032e90d8>:0x000001030f1168>
路由文件:
resources :forums do
resources :discussions
end
讨论/_form.html.erb 文件:
<%= form_for [@forum, @discussion] do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p><%= f.submit "Submit" %></p>
<% end %>
讨论控制器新动作:
def new
@forum = Forum.find_by_permalink(params[:id])
@discussion = Discussion.new
end
这是我现在得到的完整错误(在终端中):
Started GET "/forums/general-chat/discussions/new" for 127.0.0.1 at 2012-04-14 18:35:28 +0100
Processing by DiscussionsController#new as HTML
Parameters: {"forum_id"=>"general-chat"}
Forum Load (1.6ms) SELECT "forums".* FROM "forums" WHERE "forums"."permalink" IS NULL LIMIT 1
Rendered layouts/_content_full_start.html.erb (0.0ms)
Rendered discussions/_form.html.erb (574.4ms)
Rendered discussions/new.html.erb within layouts/application (575.9ms)
Completed 500 Internal Server Error in 581ms