Module: Chive::UserConcerns

Extended by:
ActiveSupport::Concern
Included in:
ApplicationController
Defined in:
app/controllers/concerns/chive/user_concerns.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_chive_userObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/concerns/chive/user_concerns.rb', line 10

def authenticate_chive_user
  if Chive.use_devise?
    send("authenticate_#{Chive.user_model.underscore}!")
  elsif Rails.env.development?
      flash[:alert] = "Warning: Authentication is not implemented. Access to admin pages is enabled in development only."
  else
    # @todo super or raise or something?
    raise "Authentication is not implemented"
  end
end

#chive_userObject



21
22
23
# File 'app/controllers/concerns/chive/user_concerns.rb', line 21

def chive_user
  send("current_#{Chive.user_model.underscore}") if Chive.use_devise?
end

#user_can_chive?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
# File 'app/controllers/concerns/chive/user_concerns.rb', line 25

def user_can_chive?
  if Chive.use_devise?
    user_signed_in?
  else
    Rails.env.development?
  end
end