You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior of true and false in string columns has changed from ActiveRecord 4.1 to 4.2. Previously, the booleans true and false would be stored as t and f, but now they are stored as 1 and 0. Is this an intended change? I don't see it mentioned in the changelog.
Why are people assigning booleans to string columns? >_>
We unintentionally changed the behavior on Sqlite3 and PostgreSQL.
Boolean values should cast to the database's representation of true and
false. This is 't' and 'f' by default, and "1" and "0" on Mysql. The
implementation to make the connection adapter specific behavior is hacky
at best, and should be re-visted once we decide how we actually want to
separate the concerns related to things that should change based on the
database adapter.
That said, this isn't something I'd expect to change based on my
database adapter. We're storing a string, so the way the database
represents a boolean should be irrelevant. It also seems strange for us
to give booleans special behavior at all in string columns. Why is
`to_s` not sufficient? It's inconsistent and confusing. Perhaps we
should consider deprecating in the future.
Fixes#17571
The behavior of
true
andfalse
in string columns has changed from ActiveRecord 4.1 to 4.2. Previously, the booleanstrue
andfalse
would be stored ast
andf
, but now they are stored as1
and0
. Is this an intended change? I don't see it mentioned in the changelog.Here is a gist which passes using ActiveRecord 4.1.7 but fails with 4.2.0.beta4: https://gist.github.com/dnrce/fd069844ea1b135bcd37
The text was updated successfully, but these errors were encountered: