From a144b41cbc5111e6282674930e660a7a29578d0a Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Sat, 12 Sep 2009 15:03:05 +0200 Subject: Removed some superfluous conditionals from the autosave association validation methods. Which are unneeded now that we only define them when needed. --- activerecord/lib/active_record/autosave_association.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record') 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 :validate or :autosave 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 # :autosave 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 -- cgit v1.2.3