Sha256: e0ddbb49286e34082cbae63f0728488aef1c7c4c1e5acf87582b8f925c64e09f

Contents?: true

Size: 1006 Bytes

Versions: 11

Compression:

Stored size: 1006 Bytes

Contents

require 'forwardable'

require 'active_support'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/numeric/time'

require 'passive_record/version'

require 'passive_record/arithmetic_helpers'
require 'passive_record/core/query'

require 'passive_record/class_inheritable_attrs'

require 'passive_record/associations'
require 'passive_record/hooks'

require 'passive_record/pretty_printing'

require 'passive_record/instance_methods'
require 'passive_record/class_methods'

module PassiveRecord
  def self.included(base)
    base.send :include, InstanceMethods
    base.send :include, ClassLevelInheritableAttributes
    base.send :include, PrettyPrinting

    base.class_eval do
      inheritable_attrs :hooks, :associations
    end

    base.extend(ClassMethods)

    model_classes << base
  end

  def self.model_classes
    @model_classes ||= []
  end

  def self.drop_all
    (model_classes + model_classes.flat_map(&:descendants)).uniq.each(&:destroy_all)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
passive_record-0.4.15 lib/passive_record.rb
passive_record-0.4.14 lib/passive_record.rb
passive_record-0.4.13 lib/passive_record.rb
passive_record-0.4.12 lib/passive_record.rb
passive_record-0.4.11 lib/passive_record.rb
passive_record-0.4.10 lib/passive_record.rb
passive_record-0.4.8 lib/passive_record.rb
passive_record-0.4.7 lib/passive_record.rb
passive_record-0.4.6 lib/passive_record.rb
passive_record-0.4.5 lib/passive_record.rb
passive_record-0.4.4 lib/passive_record.rb