Module: ActiveRecord::Bitemporal::Bitemporalize::ClassMethods
- Includes:
- Relation::Finder
- Defined in:
- lib/activerecord-bitemporal.rb
Instance Method Summary collapse
- #bitemporal_id_key ⇒ Object
-
#cached_find_by_statement(key, &block) ⇒ Object
Override ActiveRecord::Core::ClassMethods#cached_find_by_statement
.find_bynot use caching. - #inherited(klass) ⇒ Object
Methods included from Relation::Finder
#find, #find_at_time, #find_at_time!
Instance Method Details
#bitemporal_id_key ⇒ Object
40 41 42 |
# File 'lib/activerecord-bitemporal.rb', line 40 def bitemporal_id_key 'bitemporal_id' end |
#cached_find_by_statement(key, &block) ⇒ Object
Override ActiveRecord::Core::ClassMethods#cached_find_by_statement .find_by not use caching
46 47 48 |
# File 'lib/activerecord-bitemporal.rb', line 46 def cached_find_by_statement(key, &block) ActiveRecord::StatementCache.create(connection, &block) end |
#inherited(klass) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/activerecord-bitemporal.rb', line 50 def inherited(klass) super klass.prepend_relation_delegate_class ActiveRecord::Bitemporal::Relation klass.relation_delegate_class(ActiveRecord::Associations::CollectionProxy).prepend ActiveRecord::Bitemporal::CollectionProxy if relation_delegate_class(ActiveRecord::Relation).ancestors.include? ActiveRecord::Bitemporal::Relation::MergeWithExceptBitemporalDefaultScope klass.relation_delegate_class(ActiveRecord::Relation).prepend ActiveRecord::Bitemporal::Relation::MergeWithExceptBitemporalDefaultScope end end |