1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

21 commits

Author SHA1 Message Date
Pratik Naik
cc753eaf58 Replace Model.first(options) with new finder methods inside tests 2009-12-27 01:50:03 +05:30
Josh Sharpe
80989437dc I added this feature so that a Map of changed fields could be retrieved
after a model had been saved. This is useful in the after_save callback
when you need to know what fields changed. At present there is no way
to do this other than have code in the before_save callback that takes
a copy of the changes Map, which I thought was a bit messy.

Example.

  person = Person.find_by_name('bob')
  person.name = 'robert'
  person.changes # => {'name' => ['bob, 'robert']}
  person.save
  person.changes # => {}
  person.previous_changes # => {'name' => ['bob, 'robert']}
  person.reload
  person.previous_changes # => {}

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-31 12:50:27 -05:00
Mike Breen
7d254b5d74 Serialized attributes should only be saved with partial_updates when the serialized attribute is present [#2397 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:34:53 +01:00
Paul Gillard
bada18dc36 Added reset_attribute! method to ActiveRecord::AttributeMethods::Dirty which will reset an attribute to its original value should it have changed.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-04 16:23:08 -05:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Eloy Duran
ec8f045844 Add support for nested object forms to ActiveRecord and the helpers in ActionPack
Signed-Off-By: Michael Koziarski <michael@koziarski.com>

[#1202 state:committed]
2009-02-01 14:44:30 +13:00
Carlos Kozuszko
5ed119c005 Fix dirty handling of nullable non-integer numeric columns [#1692 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2009-01-16 17:23:35 +00:00
Carlos Kozuszko
c891d685de 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 state:committed]
2009-01-16 10:00:39 +13:00
Ben Symonds
091e6f791a Change field_changed? method to handle the case where a nullable integer column is changed from 0 to '0'
[#1530 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-08 15:42:13 -08:00
Rich Cavanaugh
113de01eaf Allow for the dirty tracking to work with the aliased name of aliased attributes.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#812 state:committed]
2008-09-13 11:41:14 +02:00
Tom Lea
ad562c58ea Dirty: treat two changes resulting in the original value as being unchanged.
[#798 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:13:41 -07:00
Tom Lea
992fda16ed Serialized attributes will now always be saved even with partial_updates turned on.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#788 state:committed]
2008-08-12 18:15:50 +02:00
Tim Chater
1415df8f49 Dirty: recognize when an integer changes from zero to blank. [#433 state:resolved] 2008-06-27 21:31:06 -07:00
Daniel Morrison
3610997ba3 Partial updates don't update lock_version if nothing changed. [#426 state:resolved] 2008-06-22 20:33:43 -07:00
Ryan Bates
262d23d763 ActiveRecord::Base#reload should clear dirty attributes. [#231 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-21 20:40:52 +01:00
Pratik Naik
281edce6db Ensure nil to '' doesn't get recorded by dirty for nullable integer columns. [#150 state:resolved] [Jason Dew, Pratik] 2008-05-20 20:53:47 +01:00
Xavier Noria
593e21d6ae Dirty attributes aren't cleared if save fails. [#174 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-05-12 17:04:17 -07:00
Jeremy Kemper
97019f9f5a Partial updates play nice with updated_at/on timestamps
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9159 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:49:57 +00:00
Jeremy Kemper
6b9448cdd2 Partial updates include only unsaved attributes. Off by default; set YourClass.partial_updates = true to enable.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:10:04 +00:00
Jeremy Kemper
81286f8587 Dirty typecasts attribute values before comparison, if possible. Closes #11464 [Russell Norris, mroch]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9139 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-29 22:19:26 +00:00
Jeremy Kemper
bbf738f269 Track changes to unsaved attributes
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9127 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-29 00:04:27 +00:00