Module: ActiveRecord::Bitemporal::Bitemporalize::ClassMethods
- Includes:
- Relation::Finder
- Defined in:
- lib/activerecord-bitemporal.rb
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
{ valid_from: ActiveRecord::Bitemporal::DEFAULT_VALID_FROM, valid_to: ActiveRecord::Bitemporal::DEFAULT_VALID_TO, transaction_from: ActiveRecord::Bitemporal::DEFAULT_TRANSACTION_FROM, transaction_to: ActiveRecord::Bitemporal::DEFAULT_TRANSACTION_TO }.freeze
Instance Method Summary collapse
- #bitemporal_id_key ⇒ Object
-
#cached_find_by_statement(key, &block) ⇒ Object
Override ActiveRecord::Core::ClassMethods#cached_find_by_statement ‘.find_by` not use caching.
- #inherited(klass) ⇒ Object
Methods included from Relation::Finder
#find, #find_at_time, #find_at_time!
Instance Method Details
#bitemporal_id_key ⇒ Object
46 47 48 |
# File 'lib/activerecord-bitemporal.rb', line 46 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
52 53 54 |
# File 'lib/activerecord-bitemporal.rb', line 52 def cached_find_by_statement(key, &block) ActiveRecord::StatementCache.create(connection, &block) end |
#inherited(klass) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/activerecord-bitemporal.rb', line 56 def inherited(klass) super klass.prepend_relation_delegate_class ActiveRecord::Bitemporal::Relation 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 |