diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/primitives/attribute.rb | 2 | ||||
-rw-r--r-- | lib/arel/relations/operations/group.rb | 2 | ||||
-rw-r--r-- | lib/arel/relations/operations/join.rb | 1 | ||||
-rw-r--r-- | lib/arel/relations/operations/order.rb | 2 | ||||
-rw-r--r-- | lib/arel/relations/operations/project.rb | 2 | ||||
-rw-r--r-- | lib/arel/relations/operations/where.rb | 2 | ||||
-rw-r--r-- | lib/arel/relations/relation.rb | 4 | ||||
-rw-r--r-- | lib/arel/relations/utilities.rb | 2 | ||||
-rw-r--r-- | lib/arel/relations/utilities/externalization.rb (renamed from lib/arel/relations/utilities/aggregation.rb) | 1 |
9 files changed, 12 insertions, 6 deletions
diff --git a/lib/arel/primitives/attribute.rb b/lib/arel/primitives/attribute.rb index dffe24d121..30885dd129 100644 --- a/lib/arel/primitives/attribute.rb +++ b/lib/arel/primitives/attribute.rb @@ -75,7 +75,7 @@ module Arel end def find_correlate_in(relation) - relation[self] + relation[self] || self end def descends_from?(other) diff --git a/lib/arel/relations/operations/group.rb b/lib/arel/relations/operations/group.rb index 253c4215b6..04fd9fea62 100644 --- a/lib/arel/relations/operations/group.rb +++ b/lib/arel/relations/operations/group.rb @@ -5,7 +5,7 @@ module Arel def initialize(relation, *groupings, &block) @relation = relation - @groupings = (groupings + (block_given?? [yield(self)] : [])).collect { |g| g.bind(relation) } + @groupings = (groupings + (block_given?? [yield(relatoin)] : [])).collect { |g| g.bind(relation) } end def externalizable? diff --git a/lib/arel/relations/operations/join.rb b/lib/arel/relations/operations/join.rb index 8025db095e..a72030abf9 100644 --- a/lib/arel/relations/operations/join.rb +++ b/lib/arel/relations/operations/join.rb @@ -31,6 +31,7 @@ module Arel end def wheres + # TESTME bind to self? relation1.externalize.wheres end diff --git a/lib/arel/relations/operations/order.rb b/lib/arel/relations/operations/order.rb index 82924806e2..05af3fde4d 100644 --- a/lib/arel/relations/operations/order.rb +++ b/lib/arel/relations/operations/order.rb @@ -5,7 +5,7 @@ module Arel def initialize(relation, *orderings, &block) @relation = relation - @orderings = (orderings + (block_given?? [yield(self)] : [])).collect { |o| o.bind(relation) } + @orderings = (orderings + (block_given?? [yield(relation)] : [])).collect { |o| o.bind(relation) } end # TESTME diff --git a/lib/arel/relations/operations/project.rb b/lib/arel/relations/operations/project.rb index c92a9df5a5..d7835edda4 100644 --- a/lib/arel/relations/operations/project.rb +++ b/lib/arel/relations/operations/project.rb @@ -5,7 +5,7 @@ module Arel def initialize(relation, *projections, &block) @relation = relation - @projections = (projections + (block_given?? [yield(self)] : [])).collect { |p| p.bind(relation) } + @projections = (projections + (block_given?? [yield(relation)] : [])).collect { |p| p.bind(relation) } end def attributes diff --git a/lib/arel/relations/operations/where.rb b/lib/arel/relations/operations/where.rb index 9acb8ae3c6..8882f36104 100644 --- a/lib/arel/relations/operations/where.rb +++ b/lib/arel/relations/operations/where.rb @@ -4,7 +4,7 @@ module Arel deriving :== def initialize(relation, *predicates, &block) - predicate = block_given?? yield(self) : predicates.shift + predicate = block_given?? yield(relation) : predicates.shift @relation = predicates.empty?? relation : Where.new(relation, *predicates) @predicate = predicate.bind(@relation) end diff --git a/lib/arel/relations/relation.rb b/lib/arel/relations/relation.rb index 1e2ac9f2be..a2d8bba6ea 100644 --- a/lib/arel/relations/relation.rb +++ b/lib/arel/relations/relation.rb @@ -39,6 +39,10 @@ module Arel self end + def root + self + end + def christener @christener ||= Sql::Christener.new end diff --git a/lib/arel/relations/utilities.rb b/lib/arel/relations/utilities.rb index 02c2e0a952..454d455359 100644 --- a/lib/arel/relations/utilities.rb +++ b/lib/arel/relations/utilities.rb @@ -1,5 +1,5 @@ require 'arel/relations/utilities/compound' require 'arel/relations/utilities/recursion' require 'arel/relations/utilities/nil' -require 'arel/relations/utilities/aggregation' +require 'arel/relations/utilities/externalization' require 'arel/relations/utilities/recursion'
\ No newline at end of file diff --git a/lib/arel/relations/utilities/aggregation.rb b/lib/arel/relations/utilities/externalization.rb index bdc7650a20..4e9139a78a 100644 --- a/lib/arel/relations/utilities/aggregation.rb +++ b/lib/arel/relations/utilities/externalization.rb @@ -16,6 +16,7 @@ module Arel @attributes ||= relation.attributes.collect(&:to_attribute).collect { |a| a.bind(self) } end + # REMOVEME def name relation.name + '_external' end |