diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-17 11:59:03 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-17 11:59:03 -0700 |
commit | 3f55d33e530da1b5c454e0cfe920462d497649c8 (patch) | |
tree | 261b7a842ce9b2733bc7803b5d67a14356db6216 /lib | |
parent | 732b222126bd6b37925a4fcdcda832de65858122 (diff) | |
download | rails-3f55d33e530da1b5c454e0cfe920462d497649c8.tar.gz rails-3f55d33e530da1b5c454e0cfe920462d497649c8.tar.bz2 rails-3f55d33e530da1b5c454e0cfe920462d497649c8.zip |
simplificatin of attribute division
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/primitives/attribute.rb | 18 | ||||
-rw-r--r-- | lib/arel/relations/join.rb | 1 | ||||
-rw-r--r-- | lib/arel/relations/recursion.rb | 10 |
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 |