DEV Community

Discussion on: Avoid Ransack's N+1 Pitfall!

Collapse
 
husteadrobert profile image
Robert Hustead

Sorry for the late reply!

I'm not sure I understand your question. In the example, Service and Provider are related, and I suppose you could do something like,

@q = Service.all.joins(:provider).ransack(params[:q])

perhaps? But I have not tested it. Moreover, this would bypass any resource authorization libraries (like Cancan)