:users, through: :members has_many :members, dependent: :destroy end class User < ActiveRecord::Base has_many :groups, through: :members has_many :members, dependent: :destroy end class Member < ActiveRecord::Base belongs_to :group belongs_to :user end 3/9
event :disable do transition active: :inactive end event :enable do transition inactive: :active end event :close do transition [:active, :inactive] => :closed end end 5/9