aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/import_resource.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/import_resource.rb')
-rw-r--r--app/models/import_resource.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/models/import_resource.rb b/app/models/import_resource.rb
new file mode 100644
index 000000000..f140e1b36
--- /dev/null
+++ b/app/models/import_resource.rb
@@ -0,0 +1,23 @@
+class ImportResource < ActiveRecord::Base
+ include AASM
+ belongs_to :import
+
+ 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