Class: Phcpresspro::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Phcpresspro::ApplicationController
- Defined in:
- app/controllers/phcpresspro/application_controller.rb
Direct Known Subclasses
Phcpresspro::Article::PostsController, Frontend::ArticleController, Modules::CategoriesController, Modules::ConnectionsController
Instance Method Summary collapse
- #authrocket_membership_info ⇒ Object
- #current_user ⇒ Object
- #new_login_url ⇒ Object
-
#require_user ⇒ Object
AuthRocket Definitions.
-
#user_for_paper_trail ⇒ Object
Papertrail Whodunnit Username.
Instance Method Details
#authrocket_membership_info ⇒ Object
31 32 33 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 31 def authrocket_membership_info AuthRocket::Membership.all(user_id: current_user.id).first end |
#current_user ⇒ Object
21 22 23 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 21 def current_user @_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user) end |
#new_login_url ⇒ Object
26 27 28 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 26 def new_login_url ENV['AUTHROCKET_LOGIN_URL'] end |
#require_user ⇒ Object
AuthRocket Definitions
13 14 15 16 17 18 19 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 13 def require_user unless current_user params.permit! session[:last_url] = request.get? ? url_for(params) : url_for redirect_to new_login_url end end |
#user_for_paper_trail ⇒ Object
Papertrail Whodunnit Username
36 37 38 39 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 36 def user_for_paper_trail # Default is: current_user rescue nil current_user ? current_user.username : 'Public user' end |