From fff47a5a5e92eccf949785231d1f6953d6fdc640 Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Mon, 12 May 2008 15:40:06 -0700 Subject: some memoizing and hash equality performance optimizations --- lib/arel/relations/compound.rb | 2 +- lib/arel/relations/relation.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/arel/relations') diff --git a/lib/arel/relations/compound.rb b/lib/arel/relations/compound.rb index 7b6f3a46f8..663711760c 100644 --- a/lib/arel/relations/compound.rb +++ b/lib/arel/relations/compound.rb @@ -8,7 +8,7 @@ module Arel :to => :relation def attributes - relation.attributes.collect { |a| a.bind(self) } + @attributes ||= relation.attributes.collect { |a| a.bind(self) } end end end \ No newline at end of file diff --git a/lib/arel/relations/relation.rb b/lib/arel/relations/relation.rb index 4653323514..b2f811cea2 100644 --- a/lib/arel/relations/relation.rb +++ b/lib/arel/relations/relation.rb @@ -136,7 +136,7 @@ module Arel end def find_attribute_matching_name(name) - attributes.detect { |a| a.alias_or_name.to_s == name.to_s } + attributes.detect { |a| a.named?(name) } end # TESTME - added relation_for(x)[x] because of AR -- cgit v1.2.3