Class: AdSpace::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- AdSpace::ApplicationController
show all
- Defined in:
- app/controllers/ad_space/application_controller.rb
Instance Method Summary
collapse
Instance Method Details
#_current_user ⇒ Object
17
18
19
|
# File 'app/controllers/ad_space/application_controller.rb', line 17
def _current_user
@user ||= User.find_by(id: session[:user_id])
end
|
#add_breadcrumb(name, path = nil) ⇒ Object
27
28
29
|
# File 'app/controllers/ad_space/application_controller.rb', line 27
def add_breadcrumb(name, path = nil)
breadcrumbs << AdSpace::Breadcrumb.new(name, path)
end
|
#breadcrumbs ⇒ Object
23
24
25
|
# File 'app/controllers/ad_space/application_controller.rb', line 23
def breadcrumbs
@breadcrumbs ||= []
end
|
#init_app ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'app/controllers/ad_space/application_controller.rb', line 8
def init_app
AdSpace::App.init request: request
if !_current_user&.admin?
redirect_to main_app.root_path, alert: "Permission denied - You are not authorized to access this resource.", status: :see_other
end
end
|