:has_many, :through
モデルには次の関連付けがあります。
グループモデル:
has_many :group_users
has_many :users, :through => :group_users
ユーザーモデル:
has_many :group_users
has_many :groups, :before_add => :validates_group, :through => :group_users
GroupsUsersモデル:
belongs_to :group
belongs_to :user
このgroups_users
表には、ユーザーのステータス(アクティブまたは非アクティブ)に対応する追加の列があります。ユーザーがグループから自分自身を削除したときに、その列を更新できるようにする必要があります。update_attributes
結合テーブルでどのように使用できますか?