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/has_many_through_association.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/has_many_through_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index d7ca7b5834..e232c650fa 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -49,7 +49,7 @@ module ActiveRecord def <<(*records) return if records.empty? through = @reflection.through_reflection - raise ActiveRecord::HasManyThroughCantAssociateNewRecords.new(@owner, through) if @owner.new_record? + raise ActiveRecord::HasManyThroughCantAssociateNewRecords.new(@owner, through) if @owner.new? load_target @@ -57,7 +57,7 @@ module ActiveRecord klass.transaction do flatten_deeper(records).each do |associate| raise_on_type_mismatch(associate) - raise ActiveRecord::HasManyThroughCantAssociateNewRecords.new(@owner, through) unless associate.respond_to?(:new_record?) && !associate.new_record? + raise ActiveRecord::HasManyThroughCantAssociateNewRecords.new(@owner, through) unless associate.respond_to?(:new?) && !associate.new? @owner.send(@reflection.through_reflection.name).proxy_target << klass.with_scope(:create => construct_join_attributes(associate)) { klass.create! } @target << associate @@ -127,7 +127,7 @@ module ActiveRecord def construct_quoted_owner_attributes(reflection) if as = reflection.options[:as] { "#{as}_id" => @owner.quoted_id, - "#{as}_type" => reflection.klass.quote_value( + "#{as}_type" => reflection.klass.quote( @owner.class.base_class.name.to_s, reflection.klass.columns_hash["#{as}_type"]) } else @@ -164,7 +164,7 @@ module ActiveRecord if @reflection.source_reflection.options[:as] polymorphic_join = "AND %s.%s = %s" % [ @reflection.table_name, "#{@reflection.source_reflection.options[:as]}_type", - @owner.class.quote_value(@reflection.through_reflection.klass.name) + @owner.class.quote(@reflection.through_reflection.klass.name) ] end end |