开发者

Search Logic removing records with no association from results when ordering by that association

开发者 https://www.devze.com 2023-01-04 22:09 出处:网络
I\'m using search logic to filter and order my results but it removes records from my results when I order by a association and when that association is not always 开发者_运维问答present for all recor

I'm using search logic to filter and order my results but it removes records from my results when I order by a association and when that association is not always 开发者_运维问答present for all records.

For example say I have a user model which can have one vehicle model but does not have to, if I have a results table where you can order by the users vehicles make I would hope all users without a vehicle record would be considered empty strings and therefore ordered all at the beginning followed by the other user records which have vehicles ordered by the make name.

Unfortunately all the user records which do not have a vehicle are removed from the results.

Is there anyway round this and still use search logic as I find it extremely useful


I think you'll have to explicitly assign a default vehicle that has an empty name

0

精彩评论

暂无评论...
验证码 换一张
取 消