Class: ActiveElement::ControllerAction

Inherits:
Object
  • Object
show all
Includes:
Paintbrush
Defined in:
lib/active_element/controller_action.rb

Overview

Processes all controller actions, verifies permissions, issues redirects, etc.

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ ControllerAction

Returns a new instance of ControllerAction.



8
9
10
# File 'lib/active_element/controller_action.rb', line 8

def initialize(controller)
  @controller = controller
end

Instance Method Details

#process_actionObject



12
13
14
15
16
17
18
19
20
# File 'lib/active_element/controller_action.rb', line 12

def process_action
  Rails.logger.info("#{ActiveElement.log_tag} #{colorized_permissions_message}")
  process_pre_render and return if verified_permissions?

  warn "#{ActiveElement.log_tag} #{colorized_permissions_message}" if Rails.env.test?
  return controller.redirect_to redirect_path if redirect_to_default_landing_page?

  render_forbidden
end