10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/stepper/models/active_record_additions.rb', line 10
def has_steps(options = {})
raise Stepper::StepperException.new("Options for has_steps must be in a hash.") unless options.is_a? Hash
options.each do |key, value|
unless [:current_step_column, :steps].include? key
raise Stepper::StepperException.new("Unknown option for has_steps: #{key.inspect} => #{value.inspect}.")
end
end
raise Stepper::StepperException.new(":steps condition can't be blank") if options[:steps].blank?
class_attribute :_stepper_current_step_column
self._stepper_current_step_column = options[:current_step_column] || :current_step
class_attribute :_stepper_steps
self._stepper_steps= options[:steps]
include InstanceMethods
end
|