Module: MyStuff::MultiDB::CoreExt::Base::ClassMethods
- Defined in:
- lib/my_stuff/multidb/core_ext/base.rb
Instance Method Summary collapse
- #abstract_class? ⇒ Boolean
- #arel_engine ⇒ Object
- #base_class ⇒ Object
- #connection ⇒ Object
- #connection_pool ⇒ Object
- #inherited(child) ⇒ Object
- #magic_database ⇒ Object
- #model_name ⇒ Object
Instance Method Details
#abstract_class? ⇒ Boolean
41 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 41 def abstract_class?; true; end |
#arel_engine ⇒ Object
29 30 31 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 29 def arel_engine magic_database.arel_engine end |
#base_class ⇒ Object
20 21 22 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 20 def base_class self end |
#connection ⇒ Object
33 34 35 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 33 def connection magic_database.connection end |
#connection_pool ⇒ Object
37 38 39 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 37 def connection_pool magic_database.connection_pool end |
#inherited(child) ⇒ Object
50 51 52 53 54 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 50 def inherited(child) def child.abstract_class?; false; end def child.base_class; self; end super end |
#magic_database ⇒ Object
24 25 26 27 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 24 def magic_database @magic_database ||= self.name.split('::')[0..-2].join('::').constantize end |
#model_name ⇒ Object
43 44 45 46 47 48 |
# File 'lib/my_stuff/multidb/core_ext/base.rb', line 43 def model_name # Rails form_for wants this ActiveModel::Name.new( self.name.split('::').last.tap{|s| def s.name; self; end} ) end |