diff options
Diffstat (limited to 'app/models/referential_cloning.rb')
| -rw-r--r-- | app/models/referential_cloning.rb | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/app/models/referential_cloning.rb b/app/models/referential_cloning.rb new file mode 100644 index 000000000..8d765f985 --- /dev/null +++ b/app/models/referential_cloning.rb @@ -0,0 +1,24 @@ +class ReferentialCloning < ActiveRecord::Base +  include AASM +  belongs_to :source_referential, class_name: 'Referential' +  belongs_to :target_referential, class_name: 'Referential' + +  aasm column: :status do +    state :new, :initial => true +    state :pending +    state :successful +    state :failed + +    event :run do +      transitions :from => [:new, :failed], :to => :pending +    end + +    event :successful do +      transitions :from => [:pending, :failed], :to => :successful +    end + +    event :failed do +      transitions :from => :pending, :to => :failed +    end +  end +end | 
