From a46922e4a1089c9880c30b389e1e1d9dfbab02ae Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 2 Apr 2010 19:04:23 -0700 Subject: Create an Arel::Header class representing a relation's attributes --- lib/arel/engines/memory/relations/array.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/arel/engines/memory') diff --git a/lib/arel/engines/memory/relations/array.rb b/lib/arel/engines/memory/relations/array.rb index 6486dcbcc1..d8751fa626 100644 --- a/lib/arel/engines/memory/relations/array.rb +++ b/lib/arel/engines/memory/relations/array.rb @@ -15,9 +15,12 @@ module Arel end def attributes - @attributes ||= @attribute_names_and_types.collect do |attribute, type| - attribute = type.new(self, attribute) if Symbol === attribute - attribute + @attributes ||= begin + attrs = @attribute_names_and_types.collect do |attribute, type| + attribute = type.new(self, attribute) if Symbol === attribute + attribute + end + Header.new(attrs) end end -- cgit v1.2.3