From 6e1450a2a646e416aaea003eff19b7703c563bed Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Sat, 17 May 2008 23:03:56 -0700 Subject: performance enhancements --- lib/arel/primitives/attribute.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/arel/primitives') diff --git a/lib/arel/primitives/attribute.rb b/lib/arel/primitives/attribute.rb index 5e769ac0eb..cb564c1587 100644 --- a/lib/arel/primitives/attribute.rb +++ b/lib/arel/primitives/attribute.rb @@ -38,16 +38,14 @@ module Arel end def original_relation - @original_relation ||= relation.relation_for(self) + original_attribute.relation end def original_attribute - @original_attribute ||= original_relation[self] + @original_attribute ||= history.detect { |a| !a.join? } end - module Transformations - delegate :size, :to => :history - + module Transformations def self.included(klass) klass.send :alias_method, :eql?, :== end @@ -75,8 +73,8 @@ module Arel @history ||= [self] + (ancestor ? ancestor.history : []) end - def match?(other) - history.last == other.history.last + def join? + relation.join? end def root -- cgit v1.2.3