Module: Hydra::Controller::ControllerBehavior
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/hydra/controller/controller_behavior.rb
Overview
Include this module into any of your Controller classes to add Hydra functionality
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#deny_access(exception) ⇒ Object
Override this method if you wish to customize the way access is denied.
-
#user_key ⇒ Object
get the currently configured user identifier.
Instance Method Details
#deny_access(exception) ⇒ Object
Override this method if you wish to customize the way access is denied
23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/concerns/hydra/controller/controller_behavior.rb', line 23 def deny_access(exception) if exception.action == :edit redirect_to(main_app.url_for(action: 'show'), alert: exception.) elsif current_user and current_user.persisted? redirect_to main_app.root_path, alert: exception. else session['user_return_to'.freeze] = request.url redirect_to main_app.new_user_session_path, alert: exception. end end |
#user_key ⇒ Object
get the currently configured user identifier. Can be overridden to return whatever (ie. login, email, etc) defaults to using whatever you have set as the Devise authentication_key
18 19 20 |
# File 'app/controllers/concerns/hydra/controller/controller_behavior.rb', line 18 def user_key current_user.user_key if current_user end |