method
initialize_relation_delegate_cache
v5.2.3 -
Show latest stable
- Class:
ActiveRecord::Delegation::DelegateCache
initialize_relation_delegate_cache()public
No documentation available.
# File activerecord/lib/active_record/relation/delegation.rb, line 10
def initialize_relation_delegate_cache
@relation_delegate_cache = cache = {}
[
ActiveRecord::Relation,
ActiveRecord::Associations::CollectionProxy,
ActiveRecord::AssociationRelation
].each do |klass|
delegate = Class.new(klass) {
include ClassSpecificRelation
}
include_relation_methods(delegate)
mangled_name = klass.name.gsub("::".freeze, "_".freeze)
const_set mangled_name, delegate
private_constant mangled_name
cache[klass] = delegate
end
end