Ruby on rails 嵌套形式和属于关联

Ruby on rails 嵌套形式和属于关联,ruby-on-rails,associations,Ruby On Rails,Associations,我的rails应用程序中有3个型号: 事件 地方 团体 每个事件和组都有一个位置 我有以下模型和关联: class Group < ActiveRecord::Base has_many :events belongs_to :location accepts_nested_attributes_for :location end 类组

我的rails应用程序中有3个型号:

事件 地方 团体

每个事件和组都有一个位置

我有以下模型和关联:

class Group < ActiveRecord::Base
    has_many :events
    belongs_to :location    
    accepts_nested_attributes_for :location
end
类组

类位置

class事件
我在SO和google上搜索了一下,但没有找到正确的答案,特别是关于Rails4的“如何在Bowns_to side上使用嵌套属性”

所以,请告诉我如何使用它或任何其他最好的方式来定义上述关联。
提前谢谢

你有什么问题?您想实现什么?@SharvyAhmed我想为:位置添加accepts\u nested\u attributes\u-on-alloy\u-to-side,最好的方法是什么?
class Location < ActiveRecord::Base
    has_many :groups
    has_many :events
end
class Event < ActiveRecord::Base
   belongs_to :location
   accepts_nested_attributes_for :location
end