Skip to content

Commit

Permalink
Return an empty relation instead of an array from db_relation()
Browse files Browse the repository at this point in the history
db_relation() returns an empty array if it couldn't determine
another relation to use. This empty array doesn't work with
chained activerecord methods like find_each, and breaks
functions like populate_db_data_index!
  • Loading branch information
mansam committed Jun 6, 2017
1 parent 250308a commit 03f6941
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/manager_refresh/inventory_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def db_relation(selection = nil, projection = nil)
rel
end

relation || []
relation || model_class.none
end

# Extracting references to a relation friendly format, or a format processable by a custom_db_finder
Expand Down

0 comments on commit 03f6941

Please sign in to comment.