Module: ActsAsStatused::Base

Defined in:
app/models/concerns/acts_as_statused.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_statused(*args) ⇒ Object

acts_as_statused :pending, :approved, :declined, option_key: :option_value



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/concerns/acts_as_statused.rb', line 13

def acts_as_statused(*args)
  options = args.extract_options!
  statuses = Array(args).compact

  if statuses.blank? || statuses.any? { |status| !status.kind_of?(Symbol) }
    raise 'acts_as_statused expected one or more statuses'
  end

  @acts_as_statused_options = options.merge(statuses: statuses)

  include ::ActsAsStatused
end