Class: Membership

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/membership.rb

Instance Method Summary collapse

Instance Method Details

#check_last_adminObject (protected)

check if this is the last admin-membership and deny


12
13
14
# File 'app/models/membership.rb', line 12

def check_last_admin
  raise I18n.t('model.membership.no_admin_delete') if self.group.role_admin? && self.group.memberships.size == 1 && Group.where(role_admin: true).count == 1 
end