aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/dirty.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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
* Serialized attributes should only be saved with partial_updates when the ↵Mike Breen2009-08-091-1/+1
| | | | | | serialized attribute is present [#2397 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Added reset_attribute! method to ActiveRecord::AttributeMethods::Dirty which ↵Paul Gillard2009-08-041-12/+29
| | | | | | will reset an attribute to its original value should it have changed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Concernify AR AttributeMethodsJoshua Peek2009-07-301-0/+187