From 9d7e6432b22a11e96ad7a3cab7510fac7b3927d6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 5 Sep 2006 18:48:10 +0000 Subject: 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 --- .../lib/active_record/associations/has_one_association.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record/associations/has_one_association.rb') diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 4ccd725ebd..9e7f281744 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -18,7 +18,7 @@ module ActiveRecord if replace_existing replace(record, true) else - record[@reflection.primary_key_name] = @owner.id unless @owner.new_record? + record[@reflection.primary_key_name] = @owner.id unless @owner.new? self.target = record end @@ -30,11 +30,11 @@ module ActiveRecord unless @target.nil? if dependent? && !dont_save && @target != obj - @target.destroy unless @target.new_record? + @target.destroy unless @target.new? @owner.clear_association_cache else @target[@reflection.primary_key_name] = nil - @target.save unless @owner.new_record? || @target.new_record? + @target.save unless @owner.new? || @target.new? end end @@ -48,7 +48,7 @@ module ActiveRecord @loaded = true - unless @owner.new_record? or obj.nil? or dont_save + unless @owner.new? or obj.nil? or dont_save return (obj.save ? self : false) else return (obj.nil? ? nil : self) @@ -69,7 +69,7 @@ module ActiveRecord when @reflection.options[:as] @finder_sql = "#{@reflection.klass.table_name}.#{@reflection.options[:as]}_id = #{@owner.quoted_id} AND " + - "#{@reflection.klass.table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}" + "#{@reflection.klass.table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote @owner.class.base_class.name.to_s}" else @finder_sql = "#{@reflection.table_name}.#{@reflection.primary_key_name} = #{@owner.quoted_id}" end -- cgit v1.2.3