aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-04 17:28:37 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-04 17:28:37 -0700
commit880efb9bd45a5d7134153a0f1d78cfa7f6cd8470 (patch)
tree7779c94db258e78da39a09834a789ef9c4204e0e /lib/arel
parent5e52a24e67dfedaf9b2a3bb6601f79f1f8e00c72 (diff)
downloadrails-880efb9bd45a5d7134153a0f1d78cfa7f6cd8470.tar.gz
rails-880efb9bd45a5d7134153a0f1d78cfa7f6cd8470.tar.bz2
rails-880efb9bd45a5d7134153a0f1d78cfa7f6cd8470.zip
cleanup
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/relations/join.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/arel/relations/join.rb b/lib/arel/relations/join.rb
index 1b37b3f225..048cb170e5 100644
--- a/lib/arel/relations/join.rb
+++ b/lib/arel/relations/join.rb
@@ -1,9 +1,7 @@
module Arel
class Join < Relation
attr_reader :join_sql, :relation1, :relation2, :predicates
-
delegate :engine, :to => :relation1
-
hash_on :relation1
def initialize(join_sql, relation1, relation2 = Nil.new, *predicates)
@@ -59,22 +57,20 @@ module Arel
def relation_for(attribute)
x = [relation1[attribute], relation2[attribute]].select { |a| a =~ attribute }.min do |a1, a2|
(attribute % a1).size <=> (attribute % a2).size
- end.relation
- if x.aggregation?
- x
+ end
+ if x.relation.aggregation?
+ x.relation
else
- x.relation_for(attribute) # FIXME @demeter
+ x.original_relation
end
end
private
def externalize(relation)
- Externalizer.new(self, relation)
+ Externalizer.new(relation)
end
- Externalizer = Struct.new(:christener, :relation) do
- delegate :engine, :to => :relation
-
+ Externalizer = Struct.new(:relation) do
def selects
relation.aggregation?? [] : relation.selects
end