Module: ActiveAction::ActionController::ClassMethods
- Defined in:
- lib/active_action/action_controller.rb
Instance Method Summary collapse
- #_active_actions ⇒ Object
-
#active_action(action_name, options = {}) ⇒ Object
Rails generates CSRF tokens on a per-form basis.
- #add_active_action(action_name, options = {}) ⇒ Object
- #normalize_active_action_options(action_name, options) ⇒ Object
Instance Method Details
#_active_actions ⇒ Object
39 40 41 |
# File 'lib/active_action/action_controller.rb', line 39 def _active_actions @_active_actions ||= [] end |
#active_action(action_name, options = {}) ⇒ Object
Rails generates CSRF tokens on a per-form basis. This means things will break when you change the action.
See github.com/rails/rails/pull/22275 for more info.
17 18 19 20 |
# File 'lib/active_action/action_controller.rb', line 17 def active_action(action_name, = {}) protect_from_forgery except: action_name add_active_action(action_name, ) end |
#add_active_action(action_name, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/active_action/action_controller.rb', line 22 def add_active_action(action_name, = {}) = (action_name, ) _active_actions << ActiveAction::Action.new(action_name, ) end |
#normalize_active_action_options(action_name, options) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_action/action_controller.rb', line 27 def (action_name, ) [:label] ||= action_name.to_s.titleize [:scopes] ||= [] [:scopes] += (Array.wrap([:scope])) if [:scopes].empty? [:scopes] << :all end [:scopes].map!(&:to_sym) [:path] ||= action_name end |