1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Extract comparison array to a constant for the time being until removing the check completely.

This commit is contained in:
Vipul A M 2014-01-07 19:00:55 +05:30
parent da32cd1503
commit b72e076dde

View file

@ -2,6 +2,8 @@ module Arel
class SelectManager < Arel::TreeManager class SelectManager < Arel::TreeManager
include Arel::Crud include Arel::Crud
STRING_OR_SYMBOL_CLASS = [Symbol, String]
def initialize engine, table = nil def initialize engine, table = nil
super(engine) super(engine)
@ast = Nodes::SelectStatement.new @ast = Nodes::SelectStatement.new
@ -128,7 +130,7 @@ module Arel
# FIXME: converting these to SQLLiterals is probably not good, but # FIXME: converting these to SQLLiterals is probably not good, but
# rails tests require it. # rails tests require it.
@ctx.projections.concat projections.map { |x| @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 self
end end
@ -152,7 +154,7 @@ module Arel
def order *expr def order *expr
# FIXME: We SHOULD NOT be converting these to SqlLiteral automatically # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically
@ast.orders.concat expr.map { |x| @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 self
end end