aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-08 10:53:19 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-08 10:53:19 -0200
commit371e3ae7799f18362d60259b1ea5eb8473196508 (patch)
tree468d3d48fbf5de28cc12f3c90ba923ba398b7822 /lib/arel
parentc6297d711ad2a9fd04653a5f29597c2d6bd10aeb (diff)
parentb72e076dde06c7e9d357d4b2baf87c44f8cace79 (diff)
downloadrails-371e3ae7799f18362d60259b1ea5eb8473196508.tar.gz
rails-371e3ae7799f18362d60259b1ea5eb8473196508.tar.bz2
rails-371e3ae7799f18362d60259b1ea5eb8473196508.zip
Merge pull request #237 from vipulnsward/extract-array
Extract comparison array to a constant for the time being until removing the checks completely.
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/select_manager.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index 60df12c700..5fbe642df0 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -2,6 +2,8 @@ module Arel
class SelectManager < Arel::TreeManager
include Arel::Crud
+ STRING_OR_SYMBOL_CLASS = [Symbol, String]
+
def initialize engine, table = nil
super(engine)
@ast = Nodes::SelectStatement.new
@@ -128,7 +130,7 @@ module Arel
# FIXME: converting these to SQLLiterals is probably not good, but
# rails tests require it.
@ctx.projections.concat projections.map { |x|
- [Symbol, String].include?(x.class) ? SqlLiteral.new(x.to_s) : x
+ STRING_OR_SYMBOL_CLASS.include?(x.class) ? SqlLiteral.new(x.to_s) : x
}
self
end
@@ -152,7 +154,7 @@ module Arel
def order *expr
# FIXME: We SHOULD NOT be converting these to SqlLiteral automatically
@ast.orders.concat expr.map { |x|
- String === x || Symbol === x ? Nodes::SqlLiteral.new(x.to_s) : x
+ STRING_OR_SYMBOL_CLASS.include?(x.class) ? Nodes::SqlLiteral.new(x.to_s) : x
}
self
end