0.0
No commit activity in last 3 years
No release in over 3 years
This Gem implements the option to filter/search in a ActiveRecord model by a search pattern
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

isFilterable for Rails3¶ ↑

<img src=“https://codeclimate.com/github/InWork/is_filterable.png” />

Simple AJAX filter to filter/search results a ActiveRecord Model

Install¶ ↑

Rails¶ ↑

Inside your Gemfile:

gem "is_filterable"

and then run:

bundle install

Javascripts¶ ↑

You have to include the filterable Javascript in your Javascript file.

//= require filterable

Gem Dependencies¶ ↑

Please check if all those requirements are satisfied on your environment.

  • jquery-rails

Usage¶ ↑

Model¶ ↑

In the model you have to include: class User < ActiveRecord::Base

...
is_filterable
...

end

Controller¶ ↑

In your Controller you have to use the method search. The search Method used the first parmameter as the attribute on which the query should be done and the second as input filter parameter.

In your Controller class UsersController < ApplicationController

...
def index
    @users = User.search('login',params[:search]).order('login').page(params[:page]).per_page(15)

    respond_to do |format|
      format.html # index.html.erb
      format.js
    end
  end
...

end

View¶ ↑

text_field_tag :search, params[:search], :class => "input-medium search-query search-observer", :placeholder => "user name"

Copyright © 2011 - 2012 In&Work AG. See LICENSE for details.