Module: ActionController::Acts::RegPath::ClassMethods

Defined in:
lib/reg_path/reg_path.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_reg_path(reg_path_name_or_sym, options = {}) ⇒ Object

Creates the actions and methods necessary for this controller to be a RegPath. Specifically this generates the offers action which handles moving a user through the reg path. Entry into the RegPath can be initiated by calling the begin_reg_path method. Controllers using this act must override the after_reg_path callback or supply the :after option to define what action (render, redirect, etc.) should be taken when the reg path is completed. A :setup_offers before_filter is provided for extension by including Controller. Any setup of params to be sent to the offer engine should be done here, in the @reg_path_options member variable.



24
25
26
27
28
29
30
31
32
# File 'lib/reg_path/reg_path.rb', line 24

def acts_as_reg_path(reg_path_name_or_sym, options={})
  @reg_path_name_or_sym = reg_path_name_or_sym
  @reg_path_setup_options = options
  @reg_path_setup_options[:after] ||= :after_reg_path
  
  include ActionController::Acts::RegPath::InstanceMethods
  before_filter :setup_offers, :only=>:offers          
  helper RegPathHelper
end

#reg_path_name_or_symObject



38
39
40
# File 'lib/reg_path/reg_path.rb', line 38

def reg_path_name_or_sym
  @reg_path_name_or_sym
end

#reg_path_setup_optionsObject



34
35
36
# File 'lib/reg_path/reg_path.rb', line 34

def reg_path_setup_options
  @reg_path_setup_options
end