PoorManSearch
This module implement Poor Man's Search Engin to a active-record object.
Poor Man's Search Engin is a SQL anti pattern that using LIKE with wildcards search..
Installation
Add this line to your application's Gemfile:
gem 'poor_man_search'
And then execute:
$ bundle
Usage
Example
A master table : users
Configure like this.
class User < ActiveRecord::Base
extend PoorManSearch::Searchable
string_search :name, :email
number_search :rank
time_search :registered_at
end
Search!
User.search "yamada"
User.search "yamada 太郎"
User.search "1"
User.search "2/28"
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request