diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/factory_methods.rb | 2 | ||||
-rw-r--r-- | lib/arel/predications.rb | 14 | ||||
-rw-r--r-- | lib/arel/select_manager.rb | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/arel/factory_methods.rb b/lib/arel/factory_methods.rb index 3b16feae10..cb66f6f888 100644 --- a/lib/arel/factory_methods.rb +++ b/lib/arel/factory_methods.rb @@ -37,7 +37,7 @@ module Arel ### # Create a LOWER() function def lower column - Nodes::NamedFunction.new 'LOWER', [column] + Nodes::NamedFunction.new 'LOWER', [Nodes.build_quoted(column)] end end end diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb index fb98f0a383..74411a0522 100644 --- a/lib/arel/predications.rb +++ b/lib/arel/predications.rb @@ -32,20 +32,20 @@ module Arel if other.begin == -Float::INFINITY && other.end == Float::INFINITY Nodes::NotIn.new self, [] elsif other.end == Float::INFINITY - Nodes::GreaterThanOrEqual.new(self, other.begin) + Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self)) elsif other.begin == -Float::INFINITY && other.exclude_end? - Nodes::LessThan.new(self, other.end) + Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self)) elsif other.begin == -Float::INFINITY - Nodes::LessThanOrEqual.new(self, other.end) + Nodes::LessThanOrEqual.new(self, Nodes.build_quoted(other.end, self)) elsif other.exclude_end? - left = Nodes::GreaterThanOrEqual.new(self, other.begin) - right = Nodes::LessThan.new(self, other.end) + left = Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self)) + right = Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self)) Nodes::And.new [left, right] else - Nodes::Between.new(self, Nodes::And.new([other.begin, other.end])) + Nodes::Between.new(self, Nodes::And.new([Nodes.build_quoted(other.begin, self), Nodes.build_quoted(other.end, self)])) end else - Nodes::In.new self, other + Nodes::In.new self, other.map { |x| Nodes.build_quoted(x, self) } end end diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index e3d8792aca..cd84e263ad 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -203,8 +203,8 @@ module Arel def take limit if limit - @ast.limit = Nodes::Limit.new(limit) - @ctx.top = Nodes::Top.new(limit) + @ast.limit = Nodes::Limit.new(Nodes.build_quoted(limit)) + @ctx.top = Nodes::Top.new(Nodes.build_quoted(limit)) else @ast.limit = nil @ctx.top = nil |