This project is archived and is in readonly mode.
coerce blank strings to nil values for boolean and integer fields
Reported by Josh Susser | August 19th, 2008 @ 07:53 PM
This patch fixes ActiveRecord to consistently coerce blank strings to nil values for boolean and integer fields. Prior to this change, blank strings were coerced to false for booleans, while integer fields coerced empty strings to nil and non-empty blank strings (i.e. containing whitespace) to 0.
Apparently there's a bit of controversy over this functionality. Please see this thread: http://groups.google.com/group/r...
Comments and changes to this ticket
-
Tom Ward August 19th, 2008 @ 11:28 PM
Coercing blank strings to nil for non-string columns makes a whole load of sense to me. A definite +1.
-
Michael Koziarski August 21st, 2008 @ 03:48 PM
- State changed from new to committed
-
Jeremy Kemper August 22nd, 2008 @ 05:27 AM
- State changed from committed to incomplete
- Milestone cleared.
This causes value_to_boolean(false) to return nil.
-
Repository August 22nd, 2008 @ 06:14 AM
(from [a5eb297424f68583636b762686726bc0c84703c0]) Revert "coerce blank strings to nil values for boolean and integer fields"
This reverts commit aee14630d4dc0856e597794cc731fac68c2d2e34.
[#860 state:incomplete] http://github.com/rails/rails/co...
-
Michael Koziarski August 22nd, 2008 @ 06:22 AM
Kinda disconcerting this didn't hit any test failures, so we probably need one.
It should check .is_a? String
-
Josh Susser August 22nd, 2008 @ 11:44 PM
Updated patch to fix issue. Changed the tests to actually test a :boolean field instead of an :integer one, so there is real coverage now (instead of pretend).
-
Repository August 23rd, 2008 @ 12:28 AM
- State changed from incomplete to resolved
(from [e48e77e0222292176cd9f68658dd54524f582d9b]) coerce blank strings to nil values for boolean and integer fields
[#860 state:resolved] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 860 coerce blank strings to nil values for boolean and integer fields [#860 state:incomplete] http://github.com/rails/rails/co...
- 860 coerce blank strings to nil values for boolean and integer fields [#860 state:resolved] http://github.com/rails/rails/co...