Question

I've created a ProductPage model, which has many Products - what I'm currently trying to do in Active Admin is allow the admin user to, when they are creating a new ProductPage, select several products from a list of all available products. The trouble is that there are currently around 60k products, and attempting to load the page crashes the app.

The field is written like this at the moment:

f.input :products, :collection => Product.all

Is there anything out there that will paginate the results returned from that query? Alternatively, is there a way including a search field in place of the field, and have it AJAX in a handful of records?

Was it helpful?

Solution

You can try Select2 Gem. Docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top