mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
22 lines
378 B
Ruby
22 lines
378 B
Ruby
|
require 'active_record'
|
||
|
|
||
|
class Father < ActiveRecord::Base
|
||
|
include AASM
|
||
|
|
||
|
aasm do
|
||
|
state :missing_details, :initial => true
|
||
|
state :pending_details_confirmation
|
||
|
|
||
|
event :add_details do
|
||
|
transitions :from => :missing_details, :to => :pending_details_confirmation
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def update_state
|
||
|
if may_add_details?
|
||
|
add_details!
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|