aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/dirty.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Return a null column when no column exists for an attributeSean Griffin2014-06-031-2/+1
|
* Refactor determination of whether the field has changedSean Griffin2014-06-031-27/+2
| | | | | The types know more about what is going on than the dirty module. Let's ask them!
* Rename attribute related instance variables to better express intentSean Griffin2014-05-301-1/+1
| | | | | | | | | `@attributes` was actually used for `_before_type_cast` and friends, while `@attributes_cache` is the type cast version (and caching is the wrong word there, but I'm working on removing the conditionals around that). I opted for `@raw_attributes`, because `_before_type_cast` is also semantically misleading. The values in said hash are in the state given by the form builder or database, so raw seemed to be a good word.
* [Active Record] Renamed private methods create_record and update_recordPrathamesh Sonpatki2014-02-201-2/+2
| | | | | | This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645
* Merge pull request #13799 from kbrock/better_dirtyJeremy Kemper2014-01-221-1/+21
|\ | | | | Better ActiveRecord hierarchy for Dirty and others
| * Move changed_attributes into dirty.rbKeenan Brock2014-01-221-1/+21
| | | | | | Move serialization dirty into serialization.rb
* | Add more tests for the dirty feature for enumsRafael Mendonça França2014-01-211-1/+0
| |
* | Extract all attribute changed work to its own methodRafael Mendonça França2014-01-211-3/+7
|/ | | | This will make easier to hook on this feature to customize the behavior
* Merge pull request #10816 from bogdan/less-dirty-dirtyRafael Mendonça França2013-09-231-9/+6
| | | | Make AM::Dirty less dirty to plugin into AR or other library
* Removed deprecated methods partial_updates and familyNeeraj Singh2013-07-021-11/+0
| | | | | Removed deprecated methods `partial_updates`, `partial_updates?` and `partial_updates=`
* assigning '0.0' to a nullable numeric column does not make it dirtyYves Senn2013-03-051-1/+5
|
* These are already required through AS/railsAkira Matsuda2013-01-071-1/+0
| | | | | | * dependencies/autoload * concern * deprecation
* Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-2/+2
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-6/+2
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* Revert "Get rid of the ActiveRecord::Model::DeprecationProxy thing."Jeremy Kemper2012-10-201-1/+1
| | | | This reverts commit 83846838252397b3781eed165ca301e05db39293.
* Get rid of the ActiveRecord::Model::DeprecationProxy thing.Jon Leighton2012-10-191-1/+1
| | | | | | | | | | | | | | | | | I think it's going to be too much pain to try to transition the :active_record load hook from executing against Base to executing against Model. For example, after Model is included in Base, and modules included in Model will no longer get added to the ancestors of Base. So plugins which wish to be compatible with both Model and Base should use the :active_record_model load hook which executes *before* Base gets loaded. In general, ActiveRecord::Model is an advanced feature at the moment and probably most people will continue to inherit from ActiveRecord::Base for the time being.
* Rename the partial_updates config to partial_writesJon Leighton2012-10-191-6/+18
| | | | This reflects the fact that it now impact inserts as well as updates.
* The default value of a text/blob in mysql strict mode should be nilJon Leighton2012-10-191-11/+1
| | | | | | | | | In non-strict mode it is '', but if someone is in strict mode then we should honour the strict semantics. Also, this removes the need for a completely horrible hack in dirty.rb. Closes #7780
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-09-281-4/+4
|\ | | | | | | | | Conflicts: actionpack/lib/action_view/helpers/asset_tag_helper.rb
| * fix AR::AttributeMethods::Dirty :nodoc: [ci skip]Francesco Rodriguez2012-09-211-4/+4
| |
* | Support for partial inserts.Jon Leighton2012-09-281-3/+17
|/ | | | | | | | | | | When inserting new records, only the fields which have been changed from the defaults will actually be included in the INSERT statement. The other fields will be populated by the database. This is more efficient, and also means that it will be safe to remove database columns without getting subsequent errors in running app processes (so long as the code in those processes doesn't contain any references to the removed column).
* load active_support/core_ext/class/attribute in active_support/railsXavier Noria2012-08-021-1/+0
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* Do not consider the numeric attribute as changed if the old value isRafael Mendonça França2012-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | zero and the new value is not a string. Before this commit this was the behavior r = Review.find_by_issue(0) r.issue => 0 r.changes => {} r.issue = 0 => 0 r.changed? => true r.changes => {"issue"=>[0,0]} Fixes #7237 Conflicts: activerecord/CHANGELOG.md
* changed the firm of changes_from_zero_to_string?Angelo capilleri2012-06-211-2/+2
| | | | delete *column* because is unused by the method.
* Refactor the conditionalsRafael Mendonça França2012-06-191-7/+7
|
* Validates_numericality_of is skipped when changing 0 to to non-empty stringAngelo capilleri2012-06-191-5/+15
| | | | | | | | | | This happens when A has_many many B and A accepts_nested_attributes B that has a numeric colum with initial 0 value. So a.update_attributes({:b_attributes => { :id => b.id, :numeric => 'foo' }}) passes the validation test but, the value of :numeric doesn't change. his commit forces that the update fails with the above conditions. Fixes #6393 Fixes #2331
* Simplify AR configuration code.Jon Leighton2012-06-151-2/+7
| | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-5/+0
|
* remove unnecessary codeSergey Nartimov2012-02-281-6/+0
| | | | | it was added in 36129f21b86db4bd69e932e586129e246c2a5ca8 but isn't useful anymore as corresponding tests pass without it
* Rename field_changed? to _field_changed? so that users can create a field ↵Akira Matsuda2012-02-141-3/+3
| | | | named field
* Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-1/+1
| | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* fix indentJon Leighton2011-11-301-3/+3
|
* Merge remote branch 'rails/master' into identity_mapEmilio Tagua2010-12-201-1/+2
|\ | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/persistence.rb
| * class inheritable attributes is used no more! all internal use of class ↵Josh Kalderimis2010-11-201-1/+2
| | | | | | | | | | | | inheritable has been changed to class_attribute. class inheritable attributes has been deprecated. Signed-off-by: José Valim <jose.valim@gmail.com>
* | Remove objects from identity map if save! failed, otherwise finding again ↵Emilio Tagua2010-11-191-0/+3
| | | | | | | | the same record will have invalid attributes.
* | Remove objects from identity map if save failed, otherwise finding again the ↵Emilio Tagua2010-11-191-0/+2
|/ | | | same record will have invalid attributes.
* Make should_record_timestamps? serialization aware rather than object#changed?Pratik Naik2010-11-021-4/+0
|
* Ensure save always updates timestamps when serialized attributes are presentPratik Naik2010-11-021-0/+4
|
* Replacing superclass_delegating_accessoror with class_attribute.Neeraj Singh2010-08-311-1/+1
| | | | | | | :partial_attributes will have value true or false so there is no danger of mutability here. Signed-off-by: José Valim <jose.valim@gmail.com>
* Make sure timestamp is properly referencedBlake Smith2010-05-111-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* eliminate alias_method_chain from ActiveRecordwycats2010-05-091-50/+50
|
* Dirty datetime attributes should be aware of time zone info [#3658 ↵Kristopher Murata2010-04-081-0/+6
| | | | | | state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* adds missing requires for Object#blank? and Object#present?Xavier Noria2010-03-281-0/+2
|
* fisting uninitialized ivar warnings. [#4198 state:resolved]Aaron Patterson2010-03-161-8/+8
| | | | Signed-off-by: wycats <wycats@gmail.com>
* clean up more warnings, remove unnecessary methods, fix eval line numbers. ↵Aaron Patterson2010-03-161-1/+1
| | | | | | [#4193 state:resolved] Signed-off-by: wycats <wycats@gmail.com>
* Object#tap is not needed for Ruby >= 1.8.7Xavier Noria2009-11-091-2/+0
|
* I added this feature so that a Map of changed fields could be retrievedJosh Sharpe2009-08-311-2/+9
| | | | | | | | | | | | | | | | | | | | 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>
* Extract common dirty tracking methods in AMoJoshua Peek2009-08-101-114/+9
|
* AMo overrides alias_attribute and manages aliasing all known attribute ↵Joshua Peek2009-08-101-17/+0
| | | | method matchers