Class: Spotlight::Role

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spotlight/role.rb

Constant Summary collapse

ROLES =
%w(admin curator)

Instance Method Summary collapse

Instance Method Details

#user_keyObject



11
12
13
14
15
16
17
# File 'app/models/spotlight/role.rb', line 11

def user_key
  if user
     @user_key = user.user_key
  else
    @user_key
  end
end

#user_key=(key) ⇒ Object

setting user key causes the user to get set



20
21
22
23
24
25
26
# File 'app/models/spotlight/role.rb', line 20

def user_key= key
  @user_key = key
  self.user ||= User.find_by_user_key(key)
  if user
    user.user_key = key
  end
end