Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

only find_target can raise the exception, so isolate the rescue aroun…

…d that call
  • Loading branch information...
commit 75e29e871e925cb7485cdbc283594d3d97871703 1 parent f548054
Aaron Patterson tenderlove authored
14 activerecord/lib/active_record/associations/association_collection.rb
View
@@ -351,15 +351,19 @@ def uniq_select_value
def load_target
if !@owner.new_record? || foreign_key_present?
unless loaded?
+ targets = []
+
begin
- if @target.any?
- @target = merge_target_lists(find_target, @target)
- else
- @target = find_target
- end
+ targets = find_target
rescue ActiveRecord::RecordNotFound
reset
end
+
+ if @target.any?
+ @target = merge_target_lists(targets, @target)
+ else
+ @target = targets
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.