diff options
author | David Chelimsky <dchelimsky@gmail.com> | 2010-11-07 08:05:18 -0600 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-09 13:54:04 -0200 |
commit | 1f06652a57e727700c3a673dc1f86e3b1e07ce1f (patch) | |
tree | 6ab5165939c2fcae615bd586ea0254e352f6715a /activerecord/lib/active_record/aggregations.rb | |
parent | f57b5197b3215d9dd66196e960ef5d78b7a62de1 (diff) | |
download | rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.tar.gz rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.tar.bz2 rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.zip |
use persisted? instead of new_record? wherever possible
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
without concern for whether the extended object is specifically
ActiveRecord
[#5927 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib/active_record/aggregations.rb')
-rw-r--r-- | activerecord/lib/active_record/aggregations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 16206c1056..8cd7389005 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -6,7 +6,7 @@ module ActiveRecord def clear_aggregation_cache #:nodoc: self.class.reflect_on_all_aggregations.to_a.each do |assoc| instance_variable_set "@#{assoc.name}", nil - end unless self.new_record? + end if self.persisted? end # Active Record implements aggregation through a macro-like class method called +composed_of+ |