aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-03-12 11:31:32 -0300
committerEmilio Tagua <miloops@gmail.com>2010-03-12 11:31:32 -0300
commit5e76aa7962c4e02c67c1e1515e6ae1b5ca6190a7 (patch)
treebb0347188cb8c492d3b687dd80f81dd140892b02 /lib
parent939b31da148aaa518640dc5c1a67d4e57febf6f1 (diff)
downloadrails-5e76aa7962c4e02c67c1e1515e6ae1b5ca6190a7.tar.gz
rails-5e76aa7962c4e02c67c1e1515e6ae1b5ca6190a7.tar.bz2
rails-5e76aa7962c4e02c67c1e1515e6ae1b5ca6190a7.zip
Add accessibility to projections applied to the relation.
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/algebra/relations/relation.rb1
-rw-r--r--lib/arel/algebra/relations/utilities/compound.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb
index 4cd3f8e109..51c622cbe8 100644
--- a/lib/arel/algebra/relations/relation.rb
+++ b/lib/arel/algebra/relations/relation.rb
@@ -128,6 +128,7 @@ module Arel
module DefaultOperations
def attributes; [] end
+ def projections; [] end
def wheres; [] end
def orders; [] end
def inserts; [] end
diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb
index 9eca02c8c4..1a43c76a94 100644
--- a/lib/arel/algebra/relations/utilities/compound.rb
+++ b/lib/arel/algebra/relations/utilities/compound.rb
@@ -5,7 +5,7 @@ module Arel
:column_for, :engine, :sources, :locked, :table_alias,
:to => :relation
- [:attributes, :wheres, :groupings, :orders, :havings].each do |operation_name|
+ [:attributes, :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) }