Apparently, include and select cannot be used simultaneously in a Rails search query, and this has been repeatedly noted as wontfix:
http://dev.rubyonrails.org/ticket/7147
http://dev.rubyonrails.org/ticket/5371
This seems very inconvenient to me, because the time that I would like to use is exactly the same times when I would like to use select - when every bit of performance is counted.
Is there a way around this and manually create a combined include-with-select using find_by_sql or any other method? The problem is that I donβt know how you can emulate include functionality, where it creates models in memory to store included related models, so I can enter model1.associated_models and not delete it again.
source share