Sha256: 0258aa109f8551b1b5747b9cacf184ef1767bb287aa234784553f0789b9b34b6
Contents?: true
Size: 859 Bytes
Versions: 12
Compression:
Stored size: 859 Bytes
Contents
module AASM module Persistence class << self def load_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_files_for(:active_record) base.send(:include, AASM::Persistence::ActiveRecordPersistence) elsif hierarchy.include?("Mongoid::Document") require_files_for(:mongoid) base.send(:include, AASM::Persistence::MongoidPersistence) end end private def require_files_for(persistence) ['base', "#{persistence}_persistence"].each do |file_name| require File.join(File.dirname(__FILE__), 'persistence', file_name) end end end # class << self end end # AASM
Version data entries
12 entries across 12 versions & 1 rubygems