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_user ⇒ Object
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_user ⇒ Object
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
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 |