aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-03-12 11:34:01 -0300
committerEmilio Tagua <miloops@gmail.com>2010-03-12 11:34:01 -0300
commit602722922c8365afcb3e9bed3721d61756322353 (patch)
tree8e07cc7fdf6662b77f4c7b0fb9aa6ccf55c7530a /lib
parent5e76aa7962c4e02c67c1e1515e6ae1b5ca6190a7 (diff)
parentcbb524122c6132ba37661934c09b540a68b1c64d (diff)
downloadrails-602722922c8365afcb3e9bed3721d61756322353.tar.gz
rails-602722922c8365afcb3e9bed3721d61756322353.tar.bz2
rails-602722922c8365afcb3e9bed3721d61756322353.zip
Merge branch 'master' of github.com:brynary/arel
Diffstat (limited to 'lib')
-rw-r--r--lib/arel.rb3
-rw-r--r--lib/arel/algebra/relations/operations/where.rb9
-rw-r--r--lib/arel/session.rb4
3 files changed, 13 insertions, 3 deletions
diff --git a/lib/arel.rb b/lib/arel.rb
index 14511d5b38..ef2308ca53 100644
--- a/lib/arel.rb
+++ b/lib/arel.rb
@@ -1,6 +1,7 @@
require 'active_support/inflector'
-require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/class/attribute_accessors'
+require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/object/blank'
module Arel
require 'arel/algebra'
diff --git a/lib/arel/algebra/relations/operations/where.rb b/lib/arel/algebra/relations/operations/where.rb
index 608aaeb4b7..2fc51c7f24 100644
--- a/lib/arel/algebra/relations/operations/where.rb
+++ b/lib/arel/algebra/relations/operations/where.rb
@@ -9,6 +9,15 @@ module Arel
@predicate = predicate.bind(@relation)
end
+ def engine
+ # Temporary check of whether or not the engine supports where.
+ if relation.engine.respond_to?(:supports) && !relation.engine.supports(:where)
+ Memory::Engine.new
+ else
+ relation.engine
+ end
+ end
+
def wheres
@wheres ||= (relation.wheres + [predicate]).collect { |p| p.bind(self) }
end
diff --git a/lib/arel/session.rb b/lib/arel/session.rb
index d844cd7423..c7fcc53a3b 100644
--- a/lib/arel/session.rb
+++ b/lib/arel/session.rb
@@ -11,13 +11,13 @@ module Arel
begin
@started = true
@instance = manufacture
- metaclass.class_eval do
+ singleton_class.class_eval do
undef :new
alias_method :new, :instance
end
yield
ensure
- metaclass.class_eval do
+ singleton_class.class_eval do
undef :new
alias_method :new, :manufacture
end