Class: Membership
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Membership
- Defined in:
- app/models/membership.rb
Instance Method Summary collapse
-
#check_last_admin ⇒ Object
protected
check if this is the last admin-membership and deny.
Instance Method Details
#check_last_admin ⇒ Object (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 |