3
我有以下:has_many, :through
協會對我的模型:Rails 3的更新屬性的連接表(有很多,通過協會)
組型號:
has_many :group_users
has_many :users, :through => :group_users
用戶型號:
has_many :group_users
has_many :groups, :before_add => :validates_group, :through => :group_users
羣組用戶型號:
belongs_to :group
belongs_to :user
在groups_users
表中,我有一個跟上用戶狀態(活動或非活動狀態)的附加列。當用戶從組中刪除他們時,我需要能夠更新該列。你如何在連接表上使用update_attributes
?
Thanks @elc - 我不得不這樣做的原因是幫助支持遺留系統,同時幫助支持一個系統,該系統運行主數據庫的分析數據。 – dennismonsewicz