Ruby on rails 未找到名称Cocoon gem的关联
我用的是蚕茧宝石。 我有以下错误关联 未找到名称“任务”的关联。它已经被定义了吗 在模型维度中Ruby on rails 未找到名称Cocoon gem的关联,ruby-on-rails,cocoon-gem,Ruby On Rails,Cocoon Gem,我用的是蚕茧宝石。 我有以下错误关联 未找到名称“任务”的关联。它已经被定义了吗 在模型维度中 class Dimension < ActiveRecord::Base has_many :task accepts_nested_attributes_for :tasks, :reject_if => :all_blank, :allow_destroy => true end 类维度,则拒绝\u:all\u blank,:allow\u destroy=>true 结束
class Dimension < ActiveRecord::Base
has_many :task
accepts_nested_attributes_for :tasks, :reject_if => :all_blank, :allow_destroy => true
end
类维度,则拒绝\u:all\u blank,:allow\u destroy=>true
结束
模型任务
class Task < ActiveRecord::Base
belongs_to :dimension
end
类任务
我已经尝试了一切,回顾了其他项目,但找不到解决方案
这是github上项目的链接
您将
维度中的关联定义为单数任务
。应将其定义为复数:
class Dimension < ActiveRecord::Base
has_many :tasks
accepts_nested_attributes_for :tasks, :reject_if => :all_blank, :allow_destroy => true
end
类维度,则拒绝\u:all\u blank,:allow\u destroy=>true
结束