aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra/relations/utilities')
-rw-r--r--lib/arel/algebra/relations/utilities/compound.rb6
-rw-r--r--lib/arel/algebra/relations/utilities/externalization.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb
index 7039b82575..416717310c 100644
--- a/lib/arel/algebra/relations/utilities/compound.rb
+++ b/lib/arel/algebra/relations/utilities/compound.rb
@@ -13,7 +13,7 @@ module Arel
@requires
end
- [:attributes, :wheres, :groupings, :orders, :havings, :projections].each do |operation_name|
+ [:wheres, :groupings, :orders, :havings, :projections].each do |operation_name|
class_eval <<-OPERATION, __FILE__, __LINE__
def #{operation_name}
@#{operation_name} ||= relation.#{operation_name}.collect { |o| o.bind(self) }
@@ -21,6 +21,10 @@ module Arel
OPERATION
end
+ def attributes
+ @attributes ||= relation.attributes.bind(self)
+ end
+
def hash
@hash ||= :relation.hash
end
diff --git a/lib/arel/algebra/relations/utilities/externalization.rb b/lib/arel/algebra/relations/utilities/externalization.rb
index 795a3919f2..edd8f99221 100644
--- a/lib/arel/algebra/relations/utilities/externalization.rb
+++ b/lib/arel/algebra/relations/utilities/externalization.rb
@@ -8,7 +8,7 @@ module Arel
end
def attributes
- @attributes ||= relation.attributes.collect { |a| a.to_attribute(self) }
+ @attributes ||= Header.new(relation.attributes.map { |a| a.to_attribute(self) })
end
end