我們有一個user
模型和feature
型號:在Rails中進行版本控制?
#app/models/user.rb
Class User < ActiveRecord::Base
has_many :user_features
has_many :features, through: :user_features
end
#app/models/user_feature.rb
Class UserFeature < ActiveRecord::Base
belongs_to :user
belongs_to :feature
end
#app/models/feature.rb
Class Feature < ActiveRecord::Base
has_many :user_features
has_many :users, through: :user_features
end
功能,可以添加和從用戶的賬戶
除去典型的方式做,這將是從user_features
收集add
/remove
記錄。然而,我們想存儲的所有功能用戶添加/從他們的帳戶中移除的「歷史」隨着時間的推移
我的問題是:how would I store the user_features & indicate which features have been added & which removed?
這是非常相似的版本,我認爲