lib/wicked/wizard/validations.rb in wicked-wizard-validations-0.0.1 vs lib/wicked/wizard/validations.rb in wicked-wizard-validations-0.0.2
- old
+ new
@@ -43,10 +43,10 @@
# @param step [Symbol] the name of the step you're on now
# @return [Array] the steps prior to this one
def previous_wizard_steps(step)
#cast the incoming step to a symbol
step = step.to_sym if step.is_a?(String)
- self.all_wizard_steps.slice(0,self.all_wizard_steps.index(step))
+ self.all_wizard_steps.slice(0, self.all_wizard_steps.index(step)||0)
end
# This is where the meat of the work happens.
# We call this in the class, and it iterates through all the wizard steps, calling `[wizard_step_name]_validations`
# on the class. If it responds, it should return a hash which can be passed straight into a `validates()` call