diff options
author | Carl Lerche <carllerche@mac.com> | 2010-03-12 16:39:32 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-12 16:39:32 -0800 |
commit | e9c71a864bd33b3109e802efc7d03255037a899f (patch) | |
tree | a4120f0f2be359bbf4a78688e02dd89c0503a643 /lib/arel/algebra/relations/utilities | |
parent | 3ab6ae0c601d1b4459efd8bb39650fee370aa5b8 (diff) | |
download | rails-e9c71a864bd33b3109e802efc7d03255037a899f.tar.gz rails-e9c71a864bd33b3109e802efc7d03255037a899f.tar.bz2 rails-e9c71a864bd33b3109e802efc7d03255037a899f.zip |
Support in memory ordering better.
Diffstat (limited to 'lib/arel/algebra/relations/utilities')
-rw-r--r-- | lib/arel/algebra/relations/utilities/compound.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb index 1a43c76a94..882cf8a76b 100644 --- a/lib/arel/algebra/relations/utilities/compound.rb +++ b/lib/arel/algebra/relations/utilities/compound.rb @@ -5,6 +5,11 @@ module Arel :column_for, :engine, :sources, :locked, :table_alias, :to => :relation + def self.requires(feature = nil) + @requires = feature if feature + @requires + end + [:attributes, :wheres, :groupings, :orders, :havings, :projections].each do |operation_name| class_eval <<-OPERATION, __FILE__, __LINE__ def #{operation_name} @@ -21,6 +26,18 @@ module Arel self == other end + def engine + requires = self.class.requires + engine = relation.engine + + # Temporary check of whether or not the engine supports where. + if requires && engine.respond_to?(:supports) && !engine.supports(requires) + Memory::Engine.new + else + engine + end + end + private def arguments_from_block(relation, &block) |