How do I get Filterrific Javascript and Assets to run on Rails 6?

643 Views Asked by At

I used the code from demo and the scopes and form work by themselves. When I added Materialize forms, I noticed that the form and filtering doesn't anymore.

Apparently filterrific doesn't load its javascript library (I loaded Jquery for materialize, which works fine).

From my understanding

//= require filterrific/filterrific-jquery

in assets/javascript/application.js won't work (also tried).

I also get an asset error

Asset `filterrific/filterrific-spinner.gif` was not declared to be precompiled in production.
Declare links to your assets in `app/assets/config/manifest.js`.

The gem seems Rails 6 ready (says the table on github), but there is no documentation on how to make it work with Rails 6 and WebPacker.

1

There are 1 best solutions below

0
Theekshana Wickramathilake On

Add the following line to app/assets/config/manifest.js

//= link filterrific/filterrific-spinner.gif