mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
loaded? will not raise an AR::RecordNotFound exception, so move the rescue inside the conditional
This commit is contained in:
@@ -350,8 +350,8 @@ module ActiveRecord
|
||||
|
||||
def load_target
|
||||
if !@owner.new_record? || foreign_key_present?
|
||||
begin
|
||||
unless loaded?
|
||||
unless loaded?
|
||||
begin
|
||||
if @target.is_a?(Array) && @target.any?
|
||||
@target = find_target.map do |f|
|
||||
i = @target.index(f)
|
||||
@@ -371,9 +371,9 @@ module ActiveRecord
|
||||
else
|
||||
@target = find_target
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
reset
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
reset
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user