0
我有4个模型,我不知道什么是写我的关系/协会的正确方法。如何在Rails中正确编写我的关系/关联?
class User < ActiveRecord::Base
has_many :boards
has_many :lists
has_many :cards
end
class Board < ActiveRecord::Base
belongs_to :user
has_many :lists
end
class List < ActiveRecord::Base
belongs_to :user
belongs_to :board
has_many :cards
end
class Card < ActiveRecord::Base
belongs_to :user
belongs_to :list
end
这看起来好像没什么问题。你能详细了解你需要他们如何行事或目前没有工作吗? – PhilVarg