【发布时间】:2014-11-10 04:17:42
【问题描述】:
我创建了一个嵌套资源,但我的link_to 在浏览器中显示undefined method 'model_name' for Parking::ActiveRecord_Relation:Class。我做错了,很明显。我该如何纠正?
index.rb
<%= link_to 'Create new parking', new_parking_path %></br>
<%= link_to 'Rent place', [@parking, @place_rent]%>
routes.rb
resources :parkings do
resources :place_rents, :only => [:new, :create]
end
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 routes