2015-05-16 00:46:45 -04:00
|
|
|
class Thief < ActiveRecord::Base
|
|
|
|
if ActiveRecord::VERSION::MAJOR >= 3
|
|
|
|
self.table_name = 'thieves'
|
|
|
|
else
|
|
|
|
set_table_name "thieves"
|
|
|
|
end
|
|
|
|
include AASM
|
|
|
|
aasm do
|
|
|
|
state :rich
|
|
|
|
state :jailed
|
|
|
|
initial_state Proc.new {|thief| thief.skilled ? :rich : :jailed }
|
|
|
|
end
|
|
|
|
attr_accessor :skilled, :aasm_state
|
|
|
|
end
|
2015-07-01 07:41:44 -04:00
|
|
|
|
|
|
|
class MultipleThief < ActiveRecord::Base
|
|
|
|
if ActiveRecord::VERSION::MAJOR >= 3
|
|
|
|
self.table_name = 'multiple_thieves'
|
|
|
|
else
|
|
|
|
set_table_name "multiple_thieves"
|
|
|
|
end
|
|
|
|
include AASM
|
2015-07-20 05:11:16 -04:00
|
|
|
aasm :left, :column => :aasm_state do
|
2015-07-01 07:41:44 -04:00
|
|
|
state :rich
|
|
|
|
state :jailed
|
|
|
|
initial_state Proc.new {|thief| thief.skilled ? :rich : :jailed }
|
|
|
|
end
|
|
|
|
attr_accessor :skilled, :aasm_state
|
|
|
|
end
|