class SweetActions::Action

Attributes

controller[R]

Public Class Methods

new(controller, options = {}) click to toggle source
# File lib/sweet_actions/action.rb, line 5
def initialize(controller, options = {})
  @controller = controller
  after_init(options)
end

Public Instance Methods

perform_action() click to toggle source
# File lib/sweet_actions/action.rb, line 10
def perform_action
  action
end

Private Instance Methods

action() click to toggle source
# File lib/sweet_actions/action.rb, line 24
def action
  raise "action method is required for #{self.class.name} because it inherits from SweetActions::Action"
end
after_init(options) click to toggle source
# File lib/sweet_actions/action.rb, line 18
def after_init(options); end
before_action() click to toggle source
# File lib/sweet_actions/action.rb, line 20
def before_action
  # optional hook
end
env() click to toggle source
# File lib/sweet_actions/action.rb, line 28
def env
  request.env
end
path_parameters() click to toggle source
# File lib/sweet_actions/action.rb, line 32
def path_parameters
  @path_parameters ||= env['action_dispatch.request.path_parameters']
end