Class: Faalis::ORM
- Inherits:
-
Object
- Object
- Faalis::ORM
- Defined in:
- lib/faalis/orm.rb
Overview
A very simple class which provide functionalities to work with current orm
Class Method Summary collapse
- .active_record? ⇒ Boolean
-
.current ⇒ Object
current orm.
- .mongoid? ⇒ Boolean
-
.proper_base_class ⇒ Object
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.
Class Method Details
.active_record? ⇒ Boolean
6 7 8 |
# File 'lib/faalis/orm.rb', line 6 def self.active_record? current == 'active_record' end |
.current ⇒ Object
current orm
15 16 17 |
# File 'lib/faalis/orm.rb', line 15 def self.current ::Faalis::Engine.orm.to_s end |
.mongoid? ⇒ Boolean
10 11 12 |
# File 'lib/faalis/orm.rb', line 10 def self.mongoid? current == 'mongoid' end |
.proper_base_class ⇒ Object
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
22 23 24 25 26 27 28 |
# File 'lib/faalis/orm.rb', line 22 def self.proper_base_class #TODO: fix this for rails 5 which has a new parent for each model return ::ActiveRecord::Base if active_record? return ::Object if mongoid? ::Faalis::Engine.orm = 'active_record' ::ActiveRecord::Base end |