Merge pull request #1765 from asgerb/where-patch

Only call where if needed
This commit is contained in:
Vasiliy Ermolovich 2022-03-31 17:56:59 +03:00 committed by GitHub
commit 60f73d2424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -497,7 +497,7 @@ module SimpleForm
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