12

I want to use LiveFilter https://github.com/mikemerritt/LiveFilter in my rails app. It does exactly what I want to do - filter existing elements using a search box.

How would I go about adding this (or any other) jquery plugin to rails 3.1, so that it works with the asset pipeline? If you know, will it be different in 3.2?

1 Answer 1

28

Add the livefilter.js file to your app/assets/javascripts directory, and add a require directive to your JS manifest(s) (e.g. application.js) :

//= require livefilter

AFAIK, the asset pipeline works the same in 3.1 and 3.2.

Sign up to request clarification or add additional context in comments.

3 Comments

A better place to have the plugins is in vendor/assets/javascripts, and require as usual in your application.js file
@Edward as Terw added, you can add your assets to three different locations. See guides.rubyonrails.org/asset_pipeline.html#asset-organization for more.
Thanks that's great. I've put it in vendor/assets/javascripts as Terw suggested

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.