Permalink
Browse files

push !loaded? conditional up

  • Loading branch information...
1 parent b8ed2d5 commit 0aef847927ed2f9c3e3dca92207d9a62baa01b1a @tenderlove tenderlove committed Jan 15, 2011
Showing with 8 additions and 10 deletions.
  1. +8 −10 activerecord/lib/active_record/associations/association_collection.rb
@@ -349,18 +349,16 @@ def uniq_select_value
end
def load_target
- if !@owner.new_record? || foreign_key_present?
- unless loaded?
- targets = []
-
- begin
- targets = find_target
- rescue ActiveRecord::RecordNotFound
- reset
- end
+ if (!@owner.new_record? || foreign_key_present?) && !loaded?
+ targets = []
- @target = merge_target_lists(targets, @target)
+ begin
+ targets = find_target
+ rescue ActiveRecord::RecordNotFound
+ reset
end
+
+ @target = merge_target_lists(targets, @target)
end
loaded

0 comments on commit 0aef847

Please sign in to comment.