On 3 Dec 2008, at 12:08, Ben Symonds wrote:
> > I've been playing around with Dirty (change tracking) recently, and > have > a question about the field_changed? method: I've been looking at this with ben and it does seem a bit messed up With a table like so: create_table :products do |t| t.integer :quantity, :null => false t.integer :product_id, :null => true t.timestamps end p = Product.create :quantity => 0, :product_id => 0 => #<Product id: 2, quantity: 0, product_id: 0, created_at: "2008-12-04 10:34:04", updated_at: "2008-12-04 10:34:04"> >> p.changed? #=> false >> p.quantity = '0' >> p.changed? #=> false >> p.product_id = '0' >> p.changed? #=> true It's not going to happen that often since this only happens when the existing value is 0, and only affects integer columns that can be null. Still, doesn't seem right to me. WHat ben has suggested certainly seems to do the right thing Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
