Module: TkhAuthenticationHelper::InstanceMethods

Defined in:
lib/tkh_authentication/tkh_authentication_helper.rb

Instance Method Summary collapse

Instance Method Details

#administrator?Boolean

duplicated from action controller extension. there must be a better way

Returns:

  • (Boolean)

15
16
17
# File 'lib/tkh_authentication/tkh_authentication_helper.rb', line 15

def administrator?
  @administrator ||= current_user && current_user.admin?
end

#current_userObject

duplicated from action controller extension. there must be a better way


10
11
12
# File 'lib/tkh_authentication/tkh_authentication_helper.rb', line 10

def current_user
  @current_user ||= User.find_by!(auth_token: cookies[:auth_token]) if cookies[:auth_token]
end