Class: Membership

Inherits:
ApplicationRecord 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



10
11
12
# File 'app/models/membership.rb', line 10

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