Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] Dirty objects shouldn't track changes when a nullable numeric field is assigned a blank value

#1692

This currently works fine only for decimal fields. I've created a patch with test cases to fix the problem considering also decimal and float values.

Reported by ckozus · January 3rd, 2009 @ 07:35 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. ckozus
    ckozus
    • Tag set to activerecord, bug, edge, patch
    • Title changed from Dirty objects shouldn't track changes when a nullable numeric field is assigned a blank value to [PATCH] Dirty objects shouldn't track changes when a nullable numeric field is assigned a blank value

    January 3rd, 2009 @ 07:36 PM

  2. Frederick Cheung
    Frederick Cheung

    Seems reasonable to me, however I suggest that you change the condition to ready

    
      column.number?
    

    rather than

    
    [:integer, :decimal, :float].include?(column.type)
    

    January 4th, 2009 @ 01:48 PM

  3. ckozus
    ckozus

    Thanks for the tip Frederick! I wasn't aware of the number? method.

    I'm attaching a simpler patch.

    January 4th, 2009 @ 10:24 PM

  4. Repository
    Repository
    • State changed from new to committed

    (from [9606bc883292102faaff0e3046855521d36131ef]) Fixing bug on ActiveRecord::Dirty#field_changed? for nullable numeric columns, NULL gets stored in database for blank (i.e. '') values. Only integer columns were considered.

    Signed-off-by: Michael Koziarski michael@koziarski.com [#1692 [PATCH] Dirty objects shouldn't track changes when a nullable numeric field i... state:committed] http://github.com/rails/rails/co...

    January 15th, 2009 @ 09:12 PM

  5. Repository
    Repository

    (from [c891d685de9a729332836751c1293770b86a1b52]) Fixing bug on ActiveRecord::Dirty#field_changed? for nullable numeric columns, NULL gets stored in database for blank (i.e. '') values. Only integer columns were considered.

    Signed-off-by: Michael Koziarski michael@koziarski.com [#1692 [PATCH] Dirty objects shouldn't track changes when a nullable numeric field i... state:committed] http://github.com/rails/rails/co...

    January 15th, 2009 @ 09:12 PM

  6. Repository
    Repository
    • State changed from committed to resolved

    (from [5ed119c005864b586a259e9d8def5f7aef8a4e54]) Fix dirty handling of nullable non-integer numeric columns [#1692 [PATCH] Dirty objects shouldn't track changes when a nullable numeric field i... state:resolved]

    Signed-off-by: Frederick Cheung frederick.cheung@gmail.com http://github.com/rails/rails/co...

    January 16th, 2009 @ 05:40 PM