Setting a decimal from 0.0 to '' doesn't constitute a change

If a model has a decimal value which is currently set to 0.0 and the field is blanked out with an empty string (like when submitting an empty text_field for the value), the dirty objects code does not recognize a change.

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1754-setting-a-decimal-from-00-to-doesnt-constitute-a-change

Isn’t this expected behavior?

“”.to_i == 0.0 #=> true

You are saying that assigning an empty string should nulify the value?

If you build a form to edit a model that has a decimal, you cannot blank out the value if it was originally 0.0. There is an exception for this for integers, just not decimals.

This the same as #1692 [PATCH] Dirty objects shouldn't track changes when a nullable numeric field is assigned a blank value - Ruby on Rails - rails which should be applied soon.

Fred