app/models/concerns/spotlight/user.rb in blacklight-spotlight-0.11.0 vs app/models/concerns/spotlight/user.rb in blacklight-spotlight-0.12.0
- old
+ new
@@ -2,11 +2,11 @@
##
# Spotlight user mixins for roles
module User
extend ActiveSupport::Concern
included do
- has_many :roles, class_name: 'Spotlight::Role'
+ has_many :roles, class_name: 'Spotlight::Role', dependent: :destroy
before_create :add_default_roles
end
def superadmin?
@@ -17,9 +17,13 @@
roles.where(role: 'admin')
end
def add_default_roles
roles.build role: 'admin' unless self.class.any?
+ end
+
+ def invite_pending?
+ invited_to_sign_up? && !invitation_accepted?
end
alias_attribute :user_key, :email
##