3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/acts_as_model_with_status/hook.rb', line 3
def acts_as_model_with_status(status_list, *args)
options = args.
cattr_accessor :available_statuses
cattr_accessor :invert_available_statuses
cattr_accessor :status_column
cattr_accessor :default_status
self.available_statuses = status_list
self.invert_available_statuses = self.available_statuses.invert
self.status_column = options[:column] || :status
self.default_status = options[:default]
include ActsAsModelWithStatus::InstanceMethods
after_initialize :set_default_status_if_needed
end
|