Module: MuckGroups::Models::MuckMembership

Extended by:
ActiveSupport::Concern
Defined in:
lib/muck-groups/models/membership.rb

Instance Method Summary collapse

Instance Method Details

#after_createObject



15
16
17
18
19
20
# File 'lib/muck-groups/models/membership.rb', line 15

def after_create
  if MuckGroups.configuration.enable_group_activities && group.visibility > MuckGroups::INVISIBLE
    content = I18n.t('muck.groups.joined_status', :name => self.user.display_name, :group => self.group.name)
    add_activity(group.feed_to, self, self, 'joined_group', '', content)
  end
end

#after_destroyObject



22
23
24
25
26
27
# File 'lib/muck-groups/models/membership.rb', line 22

def after_destroy
  if MuckGroups.configuration.enable_group_activities && group.visibility > MuckGroups::INVISIBLE
    content = I18n.t('muck.groups.left_status', :name => self.user.display_name, :group => self.group.name)
    add_activity(group.feed_to, self, self, 'left_group', '', content)
  end
end

#roleObject



34
35
36
# File 'lib/muck-groups/models/membership.rb', line 34

def role
  read_attribute(:role).to_sym
end

#role=(val) ⇒ Object

roles can be defined as symbols. We want to store them as strings in the database



30
31
32
# File 'lib/muck-groups/models/membership.rb', line 30

def role= val
  write_attribute(:role, val.to_s)
end