Permalink
Browse files

Rename a variable name for consistency

  • Loading branch information...
1 parent 8edfa8f commit 22bfd8b09804db28e05e598e062d58fd2ab36485 @lifo lifo committed Jan 3, 2010
@@ -6,13 +6,13 @@ class Relation
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 @@ def to_a
: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 @@ def to_a
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 @@ def preload(*associations)
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,15 +5,15 @@ def spawn(relation = @relation)
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
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|

0 comments on commit 22bfd8b

Please sign in to comment.