Commit Graph

30 Commits

Author SHA1 Message Date
Aaron Patterson
064c28d6c2 fixing dup regressions 2010-11-23 14:29:05 -08:00
Pratik Naik
e911ed1f0f Ensure save always updates timestamps when serialized attributes are present 2010-11-02 01:42:49 +00:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
José Valim
e4943e93c2 Make update_attribute behave as in Rails 2.3 and document the behavior intrinsic to its implementation. 2010-08-12 12:04:16 -03:00
Neeraj Singh
01629d1804 This patch changes update_attribute implementatino so:
- it will only save the attribute it has been asked to save and not all dirty attributes

- it does not invoke callbacks

- it does change updated_at/on

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 22:43:18 +02:00
Neeraj Singh
b462952886 Use better assertion methods for testing
[#4645 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-19 10:18:36 +02:00
Federico Brubacher
6b4e0cc526 a cloned object no longer mimics changed flags from creator , plus a test case [#4614 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 23:04:40 +02:00
Kristopher Murata
36129f21b8 Dirty datetime attributes should be aware of time zone info [#3658 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-08 10:26:16 -07:00
Jeremy Kemper
1f2738261f Hack to keep column metadata queries out of test query counts 2010-03-15 13:56:19 -07:00
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