quote(value)
public
Quotes the column value to help prevent SQL injection attacks.
Show source
def quote(value)
case value
when String, Symbol, ActiveSupport::Multibyte::Chars
"'#{quote_string(value.to_s)}'"
when true then quoted_true
when false then quoted_false
when nil then "NULL"
when BigDecimal then value.to_s("F")
when Numeric then value.to_s
when Type::Binary::Data then quoted_binary(value)
when Type::Time::Value then "'#{quoted_time(value)}'"
when Date, Time then "'#{quoted_date(value)}'"
when Class then "'#{value}'"
when ActiveSupport::Duration
warn_quote_duration_deprecated
value.to_s
else raise TypeError, "can't quote #{value.class.name}"
end
end