mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Rename a variable name for consistency
This commit is contained in:
@@ -6,13 +6,13 @@ module ActiveRecord
|
||||
|
||||
attr_reader :relation, :klass
|
||||
attr_writer :readonly, :table
|
||||
attr_accessor :preload_associations, :eager_load_associations, :include_associations
|
||||
attr_accessor :preload_associations, :eager_load_associations, :includes_associations
|
||||
|
||||
def initialize(klass, relation)
|
||||
@klass, @relation = klass, relation
|
||||
@preload_associations = []
|
||||
@eager_load_associations = []
|
||||
@include_associations = []
|
||||
@includes_associations = []
|
||||
@loaded, @readonly = false
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ module ActiveRecord
|
||||
:offset => @relation.skipped,
|
||||
:from => (@relation.send(:from_clauses) if @relation.send(:sources).present?)
|
||||
},
|
||||
ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, @eager_load_associations + @include_associations, nil))
|
||||
ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, @eager_load_associations + @includes_associations, nil))
|
||||
rescue ThrowResult
|
||||
[]
|
||||
end
|
||||
@@ -66,7 +66,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
preload = @preload_associations
|
||||
preload += @include_associations unless find_with_associations
|
||||
preload += @includes_associations unless find_with_associations
|
||||
preload.each {|associations| @klass.send(:preload_associations, @records, associations) }
|
||||
|
||||
@records.each { |record| record.readonly! } if @readonly
|
||||
|
||||
@@ -6,7 +6,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def includes(*associations)
|
||||
spawn.tap {|r| r.include_associations += Array.wrap(associations) }
|
||||
spawn.tap {|r| r.includes_associations += Array.wrap(associations) }
|
||||
end
|
||||
|
||||
def eager_load(*associations)
|
||||
|
||||
@@ -5,7 +5,7 @@ module ActiveRecord
|
||||
relation.readonly = @readonly
|
||||
relation.preload_associations = @preload_associations
|
||||
relation.eager_load_associations = @eager_load_associations
|
||||
relation.include_associations = @include_associations
|
||||
relation.includes_associations = @includes_associations
|
||||
relation.table = table
|
||||
relation
|
||||
end
|
||||
@@ -13,7 +13,7 @@ module ActiveRecord
|
||||
def merge(r)
|
||||
raise ArgumentError, "Cannot merge a #{r.klass.name} relation with #{@klass.name} relation" if r.klass != @klass
|
||||
|
||||
merged_relation = spawn(table).eager_load(r.eager_load_associations).preload(r.preload_associations).includes(r.include_associations)
|
||||
merged_relation = spawn(table).eager_load(r.eager_load_associations).preload(r.preload_associations).includes(r.includes_associations)
|
||||
merged_relation.readonly = r.readonly
|
||||
|
||||
[self.relation, r.relation].each do |arel|
|
||||
|
||||
Reference in New Issue
Block a user