diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-05 18:48:10 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-05 18:48:10 +0000 |
commit | 9d7e6432b22a11e96ad7a3cab7510fac7b3927d6 (patch) | |
tree | e2d4d84550401d00a6e0dbe0b38fc6ae475803f5 /activerecord/lib/active_record/associations/association_collection.rb | |
parent | d48322ecca83765a47c054aa72a7165efe9a81f5 (diff) | |
download | rails-9d7e6432b22a11e96ad7a3cab7510fac7b3927d6.tar.gz rails-9d7e6432b22a11e96ad7a3cab7510fac7b3927d6.tar.bz2 rails-9d7e6432b22a11e96ad7a3cab7510fac7b3927d6.zip |
Deprecated ActiveRecord::Base.new_record? in favor of ActiveRecord::Base.new? (old version still works until Rails 2.0) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/association_collection.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 552c1ed06e..97d0ec8ce8 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -23,7 +23,7 @@ module ActiveRecord flatten_deeper(records).each do |record| raise_on_type_mismatch(record) callback(:before_add, record) - result &&= insert_record(record) unless @owner.new_record? + result &&= insert_record(record) unless @owner.new? @target << record callback(:after_add, record) end @@ -51,7 +51,7 @@ module ActiveRecord def delete(*records) records = flatten_deeper(records) records.each { |record| raise_on_type_mismatch(record) } - records.reject! { |record| @target.delete(record) if record.new_record? } + records.reject! { |record| @target.delete(record) if record.new? } return if records.empty? @owner.transaction do @@ -91,7 +91,7 @@ module ActiveRecord attributes.collect { |attr| create(attr) } else record = build(attributes) - record.save unless @owner.new_record? + record.save unless @owner.new? record end end @@ -103,7 +103,7 @@ module ActiveRecord if loaded? && !@reflection.options[:uniq] @target.size elsif !loaded? && !@reflection.options[:uniq] && @target.is_a?(Array) - unsaved_records = Array(@target.detect { |r| r.new_record? }) + unsaved_records = Array(@target.detect { |r| r.new? }) unsaved_records.size + count_records else count_records |