Merge pull request #1765 from asgerb/where-patch
Only call where if needed
This commit is contained in:
commit
60f73d2424
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue