Sha256: b618e7cc8c12b2c14b87634f37c9011b4425baa2af589972c73029aec83464d2

Contents?: true

Size: 572 Bytes

Versions: 9

Compression:

Stored size: 572 Bytes

Contents

module AASM::Persistence

  # Checks to see this class or any of it's superclasses inherit from
  # ActiveRecord::Base and if so includes ActiveRecordPersistence
  def self.set_persistence(base)
    # Use a fancier auto-loading thingy, perhaps.  When there are more persistence engines.
    hierarchy = base.ancestors.map {|klass| klass.to_s}

    if hierarchy.include?("ActiveRecord::Base")
      require File.join(File.dirname(__FILE__), 'persistence', 'active_record_persistence')
      base.send(:include, AASM::Persistence::ActiveRecordPersistence)
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
aasm-2.4.0 lib/aasm/persistence.rb
alexrevin-aasm_numerical-2.3.1 lib/alexrevin-aasm_numerical/persistence.rb
aasm-2.3.1 lib/aasm/persistence.rb
aasm-2.3.0 lib/aasm/persistence.rb
aasm-2.2.1 lib/aasm/persistence.rb
aasm-2.2.0 lib/aasm/persistence.rb
mylescarrick-aasm-2.1.5 lib/aasm/persistence.rb
aasm-2.1.5 lib/aasm/persistence.rb
aasm-2.1.4 lib/aasm/persistence.rb