Table of Contents

Requirements

Present Design

Implementation

Approach

Model Level Changes

The following methods were added in groups model to handle addition and removal of group members as owners .

  add_as_owner
     Updates the is_owner column of membership record to true.
  
  remove_as_owner
     Updates the is_owner column of membership record to false.

The following columns are added in existing tables :

Table name - group_membership

Column_name type Description
is_owner boolean when set indicates a member with owner privilege and when unset indicates a normal group member

Associations modified :

 User model :
 has_many :owned_groups, :through => :memberships , :source => :group , :conditions => ['is_owner = ?',true], :foreign_key => 'user_id'
 

Work Flow

Note