aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/dirty_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused "deprecated_reload" methodclaudiob2015-01-111-4/+0
| | | | | | The method was introduced in https://github.com/rails/rails/commit/66d0a0153578ce760d822580c5b8c0b726042ac2#diff-8cec05860729a3851ceb756f4dd90370R49 for the "reset_changes is deprecated" test, but this test was successively removed in https://github.com/rails/rails/commit/37175a24bd508e2983247ec5d011d57df836c743
* Remove deprecated `ActiveModel::Dirty#reset_#{attribute}` and ↵Rafael Mendonça França2015-01-041-17/+0
| | | | `ActiveModel::Dirty#reset_changes`.
* Make restore_attributes publicRafael Mendonça França2014-07-171-5/+15
| | | | | | | Also make it accept a list of attributes to be changed. This will make possible to restore only a subset of the changed attributes. Closes #16203
* Deprecate `reset_#{attribute}` in favor of `restore_#{attribute}`.Rafael Mendonça França2014-07-151-3/+3
| | | | | | | | | These methods may cause confusion with the `reset_changes` that behaves differently of them. Also rename undo_changes to restore_changes to match this new set of methods.
* Deprecate ActiveModel::Dirty#reset_changes in favor of ↵Rafael Mendonça França2014-07-151-0/+21
| | | | | | | | | #clear_changes_information This method name is causing confusion with the `reset_#{attribute}` methods. While `reset_name` set the value of the name attribute for the previous value the `reset_changes` only discard the changes and previous changes.
* Rename rollback_changes to undo_changesRafael Mendonça França2014-06-301-2/+2
| | | | To avoid overload with database rollback
* Added rollback method to ActiveModel::Dirtyigor042014-06-231-0/+18
|
* add test coverage for activemodel Dirty#reset_changesDmitry Polushkin2014-02-091-0/+19
|
* Fix typoRafael Mendonça França2014-01-211-1/+1
|
* When applying changes or reseting changes create the right classRafael Mendonça França2014-01-201-0/+8
| | | | | | | Before this patch after the changes are applied the changes can be only accessed using string keys, but before symbols are also accepted. After this change every state of the model will be consistent.
* Allows you to check if an attribute has changed to a particular valueTejas Dinkar2013-12-151-0/+10
| | | | model.name_changed?(from: "Pete", to: "Ringo")
* Merge pull request #8791 from griffinmyers/masterRafael Mendonça França2013-10-031-1/+16
|\ | | | | | | | | | | | | Updated DirtyModel's @changed_attributes hash to be symbol/string agnostic Conflicts: activemodel/CHANGELOG.md
| * DirtyModel uses a hash to keep track of any changes made to attributesWilliam Myers2013-05-271-1/+16
| | | | | | | | | | | | | | | | | | of an instance. When using the attribute_will_change! method, you must supply a string and not a symbol or the *_changed? method will break (because it is looking for the attribute name as a string in the keys of the underlying hash). To remedy this, I simply made the underlying hash a HashWithIndifferentAccess so it won't matter if you supply the attribute name as a symbol or string to attribute_will_change!.
* | Merge pull request #10816 from bogdan/less-dirty-dirtyRafael Mendonça França2013-09-231-2/+1
| | | | | | | | Make AM::Dirty less dirty to plugin into AR or other library
* | Cleaning up ActiveModel::Dirty testsAttila Domokos2013-01-151-1/+12
|/ | | | | | | * Clarifying what the #changed method returns * Adding tests to describe what the #changed_attributes returns * Updating test name based on pull request comment * Moving the test lower in the file per pull request comment
* Reset attributes should not report changes.Renato Mascarenhas2012-12-011-2/+1
| | | | | | | | | | | When resetting an attribute, you expect it to return to the state it was before any changes. Namely, this fixes this unexpected behavior: ~~~ruby model.name = "Bob" model.reset_name! model.name_changed? #=> true ~~~
* updating define_attribute_methods documentationFrancesco Rodriguez2012-05-141-1/+1
|
* changing an attribute multiple times retains the correct original valueIan Stewart2011-06-281-0/+9
|
* Remove or fix non-working examples and add a few tests to Dirty [#5185 ↵Tore Darell2010-08-031-5/+85
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Use better assertion methods for testingNeeraj Singh2010-05-191-2/+2
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Restore changed_attributes method in ActiveModel::Dirty and loosen ↵Sam Pohlenz2010-04-011-1/+0
| | | | | | | | expectation on including class' initialize method. [#4308 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix tests added in previous commit.José Valim2010-03-271-0/+1
|
* ActiveModel::Dirty#changes should return a HashWithIndifferentAccess [#4157 ↵Jacob Atzen2010-03-271-0/+29
state:resolved] Keep the Rails style of inject Signed-off-by: José Valim <jose.valim@gmail.com>