Permalink
Browse files

Removed some superfluous conditionals from the autosave association v…

…alidation methods.

Which are unneeded now that we only define them when needed.
  • Loading branch information...
alloy committed Sep 12, 2009
1 parent 938c0ee commit a144b41cbc5111e6282674930e660a7a29578d0a
Showing with 3 additions and 5 deletions.
  1. +3 −5 activerecord/lib/active_record/autosave_association.rb
@@ -230,18 +230,16 @@ def associated_records_to_validate_or_save(association, new_record, autosave)
# 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
# Validate the associated records if <tt>:validate</tt> or
# <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

0 comments on commit a144b41

Please sign in to comment.