aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra/relations')
-rw-r--r--lib/arel/algebra/relations/operations/join.rb9
-rw-r--r--lib/arel/algebra/relations/utilities/compound.rb12
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/join.rb b/lib/arel/algebra/relations/operations/join.rb
index e47d9fa9e0..e9320f28e1 100644
--- a/lib/arel/algebra/relations/operations/join.rb
+++ b/lib/arel/algebra/relations/operations/join.rb
@@ -3,12 +3,19 @@ module Arel
attributes :relation1, :relation2, :predicates
deriving :==
delegate :name, :to => :relation1
- hash_on :relation1
def initialize(relation1, relation2 = Nil.instance, *predicates)
@relation1, @relation2, @predicates = relation1, relation2, predicates
end
+ def hash
+ @hash ||= :relation1.hash
+ end
+
+ def eql?(other)
+ self == other
+ end
+
def attributes
@attributes ||= (relation1.externalize.attributes +
relation2.externalize.attributes).collect { |a| a.bind(self) }
diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb
index 676d80a737..5e775618f1 100644
--- a/lib/arel/algebra/relations/utilities/compound.rb
+++ b/lib/arel/algebra/relations/utilities/compound.rb
@@ -1,7 +1,6 @@
module Arel
class Compound < Relation
attr_reader :relation
- hash_on :relation
delegate :joins, :join?, :inserts, :taken, :skipped, :name, :externalizable?,
:column_for, :engine,
:to => :relation
@@ -14,7 +13,16 @@ module Arel
OPERATION
end
- private
+ def hash
+ @hash ||= :relation.hash
+ end
+
+ def eql?(other)
+ self == other
+ end
+
+ private
+
def arguments_from_block(relation, &block)
block_given?? [yield(relation)] : []
end