Class: Phcpresspro::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Phcpresspro::ApplicationController
- Defined in:
- app/controllers/phcpresspro/application_controller.rb
Direct Known Subclasses
Phcpresspro::Articles::PostsController, Frontend::ArticlesController, Modules::CategoriesController, Modules::ConnectionsController
Instance Method Summary collapse
- #current_user ⇒ Object
-
#membership_info ⇒ Object
Grab Auth Member Information.
- #new_login_url ⇒ Object
-
#phcpress_recent_posts ⇒ Object
PHCPress Widget Helpers.
-
#require_user ⇒ Object
AuthRocket User Helpers.
Instance Method Details
#current_user ⇒ Object
19 20 21 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 19 def current_user @_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user) end |
#membership_info ⇒ Object
Grab Auth Member Information
30 31 32 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 30 def membership_info AuthRocket::Membership.all(user_id: current_user.id).first end |
#new_login_url ⇒ Object
24 25 26 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 24 def new_login_url ENV['AUTHROCKET_LOGIN_URL'] end |
#phcpress_recent_posts ⇒ Object
PHCPress Widget Helpers
40 41 42 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 40 def phcpress_recent_posts @recent_posts = Articles::Post.all end |
#require_user ⇒ Object
AuthRocket User Helpers
11 12 13 14 15 16 17 |
# File 'app/controllers/phcpresspro/application_controller.rb', line 11 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 |