app/models/spotlight/role.rb in blacklight-spotlight-2.3.2 vs app/models/spotlight/role.rb in blacklight-spotlight-2.3.3
- old
+ new
@@ -2,10 +2,15 @@
##
# Exhibit authorization roles
class Role < ActiveRecord::Base
ROLES = %w(admin curator).freeze
belongs_to :resource, polymorphic: true, optional: true
- belongs_to :user, class_name: Spotlight::Engine.config.user_class, autosave: true, required: true
+
+ # Ignoring for https://github.com/rubocop-hq/rubocop/issues/6764
+ # rubocop:disable Rails/ReflectionClassName
+ belongs_to :user, class_name: Spotlight::Engine.config.user_class, autosave: true, optional: false
+ # rubocop:enable Rails/ReflectionClassName
+
validates :role, inclusion: { in: ROLES }
validate :user_must_be_unique, if: :user
def user_key
if user