Sha256: 665dad6a7c2f99f3f94d0fb3f3c99079bf3a9716c208b1219e7c54f099dd4f0e

Contents?: true

Size: 676 Bytes

Versions: 18

Compression:

Stored size: 676 Bytes

Contents

module Faalis
  # A very simple class which provide functionalities to work with
  # current orm
  class ORM

    def self.active_record?
      current == 'active_record'
    end

    def self.mongoid?
      current == 'mongoid'
    end

    # current orm
    def self.current
      Faalis::Engine.orm.to_s
    end

    # This class method returns the base class of current ORM
    # It will be used in models to specify which class to inherit
    # from, based on current ORM
    def self.proper_base_class
      return ActiveRecord::Base if active_record?
      return Object if mongoid?
      Faalis::Engine.orm = 'active_record'
      ActiveRecord::Base
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
faalis-2.0.8 lib/faalis/orm.rb
faalis-2.0.7 lib/faalis/orm.rb
faalis-2.0.5 lib/faalis/orm.rb
faalis-2.0.4 lib/faalis/orm.rb
faalis-2.0.3 lib/faalis/orm.rb
faalis-2.0.1 lib/faalis/orm.rb
faalis-2.0.0 lib/faalis/orm.rb
faalis-2.0.0.rc6 lib/faalis/orm.rb
faalis-2.0.0.rc5 lib/faalis/orm.rb
faalis-2.0.0.rc4 lib/faalis/orm.rb
faalis-2.0.0.rc3 lib/faalis/orm.rb
faalis-2.0.0.rc2 lib/faalis/orm.rb
faalis-1.0.0 lib/faalis/orm.rb
faalis-1.0.0.alpha4 lib/faalis/orm.rb
faalis-1.0.0.alpha3 lib/faalis/orm.rb
faalis-1.0.0.alpha2 lib/faalis/orm.rb
faalis-1.0.0.alpha1 lib/faalis/orm.rb
faalis-1.0.0.alpha0 lib/faalis/orm.rb