aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-09-05 18:54:24 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-09-05 18:54:24 +0000
commit85fbb22f071b96d5a20ac71dc16d4432c08cdcf3 (patch)
tree4b8482edbaf0c2e598735a14b919a40315f1252b /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
parent9d7e6432b22a11e96ad7a3cab7510fac7b3927d6 (diff)
downloadrails-85fbb22f071b96d5a20ac71dc16d4432c08cdcf3.tar.gz
rails-85fbb22f071b96d5a20ac71dc16d4432c08cdcf3.tar.bz2
rails-85fbb22f071b96d5a20ac71dc16d4432c08cdcf3.zip
Backed out of new_record? to new? transformation as it would screw up existing models that did boolean calls on "new" attributes [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index f10c5957f8..8c0e50e38e 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -19,7 +19,7 @@ module ActiveRecord
attributes.collect { |attr| create(attr) }
else
record = build(attributes)
- insert_record(record) unless @owner.new?
+ insert_record(record) unless @owner.new_record?
record
end
end
@@ -75,7 +75,7 @@ module ActiveRecord
join_attributes.each { |key, value| record[key.to_s] = value }
callback(:before_add, record)
- insert_record(record) unless @owner.new?
+ insert_record(record) unless @owner.new_record?
@target << record
callback(:after_add, record)
@@ -101,7 +101,7 @@ module ActiveRecord
end
def insert_record(record)
- if record.new?
+ if record.new_record?
return false unless record.save
end
@@ -118,7 +118,7 @@ module ActiveRecord
attributes[column.name] = record.quoted_id
else
if record.attributes.has_key?(column.name)
- value = @owner.send(:quote, record[column.name], column)
+ value = @owner.send(:quote_value, record[column.name], column)
attributes[column.name] = value unless value.nil?
end
end