Sha256: 9335b463c2997bcb17a350042cffe2d0b548832731f306352967d361f277c2d5

Contents?: true

Size: 1 KB

Versions: 32

Compression:

Stored size: 1 KB

Contents

module Imports
  module Status
    # Import status transitions:
    #   pending -> approved -> imported
    
    def self.included(base)
      base.class_eval do
        attr_accessible :status
      end
    end
    
    
    def caching!
      save if new_record?
      self.update_column(:status, "caching")
      Delayed::Job.enqueue self
    end

    def pending!
      self.update_column(:status, "pending")
    end

    def approve!
      self.update_column(:status,"approved")
      Delayed::Job.enqueue self
    end

    def invalidate!
      self.update_column(:status, "invalid")
    end

    def importing!
      self.update_column(:status, "importing")
    end

    def imported!
      self.update_column(:status, "imported")
    end

    def recalling!
      self.update_column(:status, "recalling")
    end

    def recalled!
      self.update_column(:status, "recalled")
    end

    def failed!
      self.update_column(:status, "failed")
    end

    def failed?
      self.status == "failed"
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
artfully_ose-1.3.0.pre4 app/models/imports/status.rb
artfully_ose-1.3.0.pre3 app/models/imports/status.rb
artfully_ose-1.3.0.pre2 app/models/imports/status.rb
artfully_ose-1.3.0.pre1 app/models/imports/status.rb
artfully_ose-1.2.0 app/models/imports/status.rb
artfully_ose-1.2.0.beta.1 app/models/imports/status.rb
artfully_ose-1.2.0.alpha.2 app/models/imports/status.rb
artfully_ose-1.2.0.alpha.1 app/models/imports/status.rb
artfully_ose-1.2.0.pre.27 app/models/imports/status.rb
artfully_ose-1.2.0.pre.26 app/models/imports/status.rb
artfully_ose-1.2.0.pre.24 app/models/imports/status.rb
artfully_ose-1.2.0.pre.23 app/models/imports/status.rb
artfully_ose-1.2.0.pre.21 app/models/imports/status.rb
artfully_ose-1.2.0.pre.20 app/models/imports/status.rb
artfully_ose-1.2.0.pre.19 app/models/imports/status.rb
artfully_ose-1.2.0.pre.18 app/models/imports/status.rb
artfully_ose-1.2.0.pre.17 app/models/imports/status.rb
artfully_ose-1.2.0.pre.16 app/models/imports/status.rb
artfully_ose-1.2.0.pre.15 app/models/imports/status.rb
artfully_ose-1.2.0.pre.12 app/models/imports/status.rb