如何在rails 3.1中添加jquery插件

时间:2022-10-31 18:46:44

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.

我想在我的rails应用程序中使用LiveFilter https://github.com/mikemerritt/LiveFilter。它完全符合我的要求 - 使用搜索框过滤现有元素。

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?

我如何将此(或任何其他)jquery插件添加到rails 3.1,以便它可以与资产管道一起使用?如果你知道,它会在3.2中有所不同吗?

1 个解决方案

#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) :

将livefilter.js文件添加到app / assets / javascripts目录,并向JS清单添加require指令(例如application.js):

//= require livefilter

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

AFAIK,资产管道在3.1和3.2中的工作方式相同。

#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) :

将livefilter.js文件添加到app / assets / javascripts目录,并向JS清单添加require指令(例如application.js):

//= require livefilter

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

AFAIK,资产管道在3.1和3.2中的工作方式相同。