This project is archived and is in readonly mode.

#1518 ✓duplicate
Felipe Giotto

Bug with dirty models in integer fields

Reported by Felipe Giotto | December 5th, 2008 @ 05:26 PM | in 2.x

There's a problem with dirty models.

I can use the following example:

There's a model named Person, with name(string) and age(integer).

p = Person.first p.update_attributes :age => 0, :name => 'Felipe'

This SQL runs: UPDATE people SET age = 0, name = 'Felipe' WHERE id = 1 Then, I typed:

p.update_attributes :age => '', :name => 'John'

This SQL runs: UPDATE people SET name = 'John' WHERE id = 1

When the value changes from 0 to '' (supposed to be stored as nil), Rails didn't recognize it as a change!

Comments and changes to this ticket

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

Pages