aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/primitives/attribute.rb18
-rw-r--r--lib/arel/relations/join.rb1
-rw-r--r--lib/arel/relations/recursion.rb10
3 files changed, 3 insertions, 26 deletions
diff --git a/lib/arel/primitives/attribute.rb b/lib/arel/primitives/attribute.rb
index 1de2bf7cb0..bb951638e4 100644
--- a/lib/arel/primitives/attribute.rb
+++ b/lib/arel/primitives/attribute.rb
@@ -38,12 +38,11 @@ module Arel
end
def original_relation
- relation.relation_for(self)
- # root.relation
+ @original_relation ||= relation.relation_for(self)
end
def original_attribute
- original_relation[self]
+ @original_attribute ||= original_relation[self]
end
module Transformations
@@ -78,19 +77,8 @@ module Arel
history.include?(other)
end
- def root?
- relation.root?
- end
-
- def root
- @root ||= history.detect(&:root?)
- end
-
def /(other)
- if other then (history & other.history).size.to_f / Set.new(history + other.history).size
- else 0
- end
- # 1 / (history.index(other) || -1)
+ other ? (history & other.history).size : 0
end
end
include Congruence
diff --git a/lib/arel/relations/join.rb b/lib/arel/relations/join.rb
index 8e29f0492b..88d5f45b67 100644
--- a/lib/arel/relations/join.rb
+++ b/lib/arel/relations/join.rb
@@ -39,7 +39,6 @@ module Arel
relation1.externalize.selects
end
- # XXX
def relation_for(attribute)
[
relation1.externalize.relation_for(attribute),
diff --git a/lib/arel/relations/recursion.rb b/lib/arel/relations/recursion.rb
index ea8109d87d..fa4d9969c9 100644
--- a/lib/arel/relations/recursion.rb
+++ b/lib/arel/relations/recursion.rb
@@ -9,19 +9,9 @@ module Arel
formatter.table self
end
- def root?
- true
- end
-
def relation_for(attribute)
self[attribute] && self
end
end
end
-
- class Relation
- def root?
- false
- end
- end
end \ No newline at end of file