Module: Wicked::Controller::Concerns::Steps::ClassMethods

Defined in:
lib/wicked/controller/concerns/steps.rb

Instance Method Summary collapse

Instance Method Details

#check_protected!(wizard_steps) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/wicked/controller/concerns/steps.rb', line 60

def check_protected!(wizard_steps)
  string_steps = wizard_steps.map(&:to_s)
  if protected_step = PROTECTED_STEPS.detect { |protected| string_steps.include?(protected) }
    msg = "Protected step detected: '#{protected_step}' is used internally by Wicked please rename your step"
    raise WickedProtectedStepError, msg
  end
end

#steps(*args) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/wicked/controller/concerns/steps.rb', line 51

def steps(*args)
  options = args.extract_options!
  steps   = args
  check_protected!(steps)
  prepend_before_action(options) do
    self.steps = steps.dup
  end
end