mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
drying up true and false cases
This commit is contained in:
@@ -22,10 +22,14 @@ module ActiveRecord
|
||||
"'#{quote_string(value)}'" # ' (for ruby-mode)
|
||||
end
|
||||
|
||||
when nil then "NULL"
|
||||
when true then (column && column.type == :integer ? '1' : quoted_true)
|
||||
when false then (column && column.type == :integer ? '0' : quoted_false)
|
||||
when true, false
|
||||
if column && column.type == :integer
|
||||
value ? '1' : '0'
|
||||
else
|
||||
value ? quoted_true : quoted_false
|
||||
end
|
||||
# BigDecimals need to be put in a non-normalized form and quoted.
|
||||
when nil then "NULL"
|
||||
when BigDecimal then value.to_s('F')
|
||||
when Numeric then value.to_s
|
||||
when Date, Time then "'#{quoted_date(value)}'"
|
||||
|
||||
Reference in New Issue
Block a user