| Class | ActionFlow::ActionStep |
| In: |
lib/action_flow/action_step.rb
|
| Parent: | ActionFlow::FlowStep |
This class allows the controllers to create action steps. Action steps do nothing but call a method defined in the controller and then route the flow according to it‘s events mapping.
action_step :action_name do on :success => :another_step on :back => :yet_another_step end
The method identified by :action_name will simply be called and then the flow will be routed to either another_step or yet_another_step steps.
One could also use the action_step instruction to batch define action steps. Simply call the action_step instruction and give it a comma separated list of step names.
action_step :first_step, :second_step do (...) end
The ViewStep class inherits all the standard step methods defined in FlowStep class.
Initializes the instance
# File lib/action_flow/action_step.rb, line 60 def initialize( m_action_name ) @action_name = m_action_name end
This method is required by the ActionFlow::Base and will be called once it relays the execution to this step instance
# File lib/action_flow/action_step.rb, line 71 def execute(*args) # Verify if the controller answers to the @action_name value raise ActionFlowError, "The action step #{@action_name} is not defined in your controller." unless args[0].respond_to? lookup_method_to_call(@action_name) # The controller defines a method with the same name as @action_name. # Kewl! A 'someone else problem' !!! return args[0].send( lookup_method_to_call( @action_name ) ) end