aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-17 16:14:28 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 16:14:28 -0400
commit44743bed5568b3065e4f9da7972e3ea1d0d9e728 (patch)
treea94ba2e964e516e47c7e48e2c746747f6a3f0acd /lib
parent7a51983efc50c8f9092785b1b586f8884dedc01a (diff)
downloadrails-44743bed5568b3065e4f9da7972e3ea1d0d9e728.tar.gz
rails-44743bed5568b3065e4f9da7972e3ea1d0d9e728.tar.bz2
rails-44743bed5568b3065e4f9da7972e3ea1d0d9e728.zip
joining across engines in either direction
Conflicts: spec/arel/engines/memory/integration/joins/cross_engine_spec.rb
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/algebra/relations/operations/join.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/arel/algebra/relations/operations/join.rb b/lib/arel/algebra/relations/operations/join.rb
index 695f360b51..02a8fa629d 100644
--- a/lib/arel/algebra/relations/operations/join.rb
+++ b/lib/arel/algebra/relations/operations/join.rb
@@ -2,7 +2,7 @@ module Arel
class Join < Relation
attributes :relation1, :relation2, :predicates
deriving :==
- delegate :engine, :name, :to => :relation1
+ delegate :name, :to => :relation1
hash_on :relation1
def initialize(relation1, relation2 = Nil.instance, *predicates)
@@ -31,6 +31,10 @@ module Arel
def join?
true
end
+
+ def engine
+ relation1.engine != relation2.engine ? Memory::Engine.new : relation1.engine
+ end
end
class InnerJoin < Join; end
@@ -39,6 +43,10 @@ module Arel
def attributes
relation1.externalize.attributes
end
+
+ def engine
+ relation1.engine
+ end
end
class Relation