app/models/concerns/spotlight/user.rb in blacklight-spotlight-0.1.0 vs app/models/concerns/spotlight/user.rb in blacklight-spotlight-0.2.0

- old
+ new

@@ -1,16 +1,22 @@ module Spotlight::User extend ActiveSupport::Concern included do has_many :roles, class_name: 'Spotlight::Role' + + before_create :add_default_roles end def superadmin? admin_roles.where(exhibit_id: nil).any? end def admin_roles roles.where(role: 'admin') + end + + def add_default_roles + roles.build role: 'admin' unless self.class.any? end alias_attribute :user_key, :email module ClassMethods