Skip to content

Commit

Permalink
Only call where if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
asgerb committed Mar 11, 2022
1 parent 159f401 commit e2e4dd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/simple_form/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def fetch_association_collection(reflection, options)
conditions = reflection.options[:conditions]
conditions = object.instance_exec(&conditions) if conditions.respond_to?(:call)

relation = relation.where(conditions) if relation.respond_to?(:where)
relation = relation.where(conditions) if relation.respond_to?(:where) && conditions.present?
relation = relation.order(order) if relation.respond_to?(:order)
end

Expand Down

0 comments on commit e2e4dd3

Please sign in to comment.