在我的Rails3应用程序中,我有以下简单的关系结构:
class Rollout < ActiveRecord::Base
has_many :items, :through => :rollout_items
end
class RolloutItem < ActiveRecord::Base
belongs_to :rollout
belongs_to :item
end
class Item < ActiveRecord::Base
has_many :rollouts, :through => :rollout_items
end控制器:
def new
@rollout = Rollout.new
end我用下面的形式得到了上面的错误:
<%= simple_form_for @rollout do |f| %>
<%= f.association :items %>
<% end %>发布于 2013-05-20 22:48:01
Rollout和RolloutItem之间缺少关系
class Rollout < ActiveRecord::Base
has_many :rollout_items # This.
has_many :items, :through => :rollout_items
endItem也是如此。
https://stackoverflow.com/questions/16651479
复制相似问题