Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 2524ac84e6ae165082e764e94cdbbced069e43b3 1 parent c024549
Eloy Durán alloy authored
Showing with 3 additions and 5 deletions.
  1. +3 −5 activerecord/lib/active_record/autosave_association.rb
8 activerecord/lib/active_record/autosave_association.rb
View
@@ -231,10 +231,8 @@ 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
@@ -242,7 +240,7 @@ def validate_single_association(reflection)
# <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
Please sign in to comment.
Something went wrong with that request. Please try again.