aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEloy Duran <eloy.de.enige@gmail.com>2009-09-12 15:03:05 +0200
committerEloy Duran <eloy.de.enige@gmail.com>2009-09-12 16:04:47 +0200
commita144b41cbc5111e6282674930e660a7a29578d0a (patch)
tree9ae93cd28e416f24b6f25baef53d40d7b2947f40
parent938c0ee0455b8e784a771ce31631d9ec376ee6ab (diff)
downloadrails-a144b41cbc5111e6282674930e660a7a29578d0a.tar.gz
rails-a144b41cbc5111e6282674930e660a7a29578d0a.tar.bz2
rails-a144b41cbc5111e6282674930e660a7a29578d0a.zip
Removed some superfluous conditionals from the autosave association validation methods.
Which are unneeded now that we only define them when needed.
-rw-r--r--activerecord/lib/active_record/autosave_association.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index 7b5bd33863..8f37fcd515 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -230,10 +230,8 @@ module ActiveRecord
# Validate the association if <tt>:validate</tt> or <tt>:autosave</tt> is
# turned on for the association specified by +reflection+.
def validate_single_association(reflection)
- if reflection.options[:validate] == true || reflection.options[:autosave] == true
- if (association = association_instance_get(reflection.name)) && !association.target.nil?
- association_valid?(reflection, association)
- end
+ if (association = association_instance_get(reflection.name)) && !association.target.nil?
+ association_valid?(reflection, association)
end
end
@@ -241,7 +239,7 @@ module ActiveRecord
# <tt>:autosave</tt> is turned on for the association specified by
# +reflection+.
def validate_collection_association(reflection)
- if reflection.options[:validate] != false && association = association_instance_get(reflection.name)
+ if association = association_instance_get(reflection.name)
if records = associated_records_to_validate_or_save(association, new_record?, reflection.options[:autosave])
records.each { |record| association_valid?(reflection, record) }
end