Dog_the_data_hunter is a project mainly written in Ruby, based on the MIT license.
Easily search multiple model attributes at once
Adds a named scope named search to any of your models. Once included, you can search on any attribute you specify.
You have a User model and would like to be able to search all users by either their first name, last name or email address:
class User < ActiveRecord::Base
include DogTheDataHunter
search_attributes :first_name, :last_name, :email, :exact_match => false
end
This creates a named scope on the model called "search" which you can pass a string to:
User.search("Gavin").all(:order => "last_name, first_name")
Options:
Copyright (c) 2010 Gavin Morrice, released under the MIT license