aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/autosave_association.rb
diff options
context:
space:
mode:
authorEloy Duran <eloy.de.enige@gmail.com>2009-12-31 14:07:56 +0100
committerEloy Duran <eloy.de.enige@gmail.com>2010-01-07 13:19:48 +0100
commit2171e0a1d13a176db1e9e9dd55242fdb319b526c (patch)
treedf7594c11e84aeee8541603219a88d2a13e372e5 /activerecord/lib/active_record/autosave_association.rb
parentf82adc7c5addb4f9bf6b9cb3f1fcf3fb47505e53 (diff)
downloadrails-2171e0a1d13a176db1e9e9dd55242fdb319b526c.tar.gz
rails-2171e0a1d13a176db1e9e9dd55242fdb319b526c.tar.bz2
rails-2171e0a1d13a176db1e9e9dd55242fdb319b526c.zip
Cleanup some code in nested_attributes.rb, autosave_association.rb, and associations.rb with AssociationReflection#collection_association?
Also cache the result value.
Diffstat (limited to 'activerecord/lib/active_record/autosave_association.rb')
-rw-r--r--activerecord/lib/active_record/autosave_association.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index 98ab64537e..62cb996b5d 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -167,8 +167,7 @@ module ActiveRecord
validation_method = "validate_associated_records_for_#{reflection.name}"
force_validation = (reflection.options[:validate] == true || reflection.options[:autosave] == true)
- case reflection.macro
- when :has_many, :has_and_belongs_to_many
+ if reflection.collection_association?
unless method_defined?(save_method)
before_save :before_save_collection_association