public
Description: Plugin adding simple searching to ActiveRecord models
Clone URL: git://github.com/joshuaclayton/acts_as_searchable.git
Search Repo:
name age message
folder .gitignore Sat Mar 15 08:53:07 -0700 2008 Added gitignore file [joshuaclayton]
folder MIT-LICENSE Mon Feb 18 19:56:05 -0800 2008 Initial import [jclayton]
folder README Wed Jul 02 06:51:34 -0700 2008 Merge branch 'master' of git@github.com:joshuac... [joshuaclayton]
folder Rakefile Mon Feb 18 19:56:05 -0800 2008 Initial import [jclayton]
folder init.rb Mon Feb 18 19:56:05 -0800 2008 Initial import [jclayton]
folder lib/ Wed Jul 02 06:51:34 -0700 2008 Merge branch 'master' of git@github.com:joshuac... [joshuaclayton]
folder tasks/ Mon Feb 18 19:56:05 -0800 2008 Initial import [jclayton]
folder test/ Mon Feb 18 19:56:05 -0800 2008 Initial import [jclayton]
README
ActsAsSearchable
================

ActsAsSearchable provides a simple way to search upon a model.  It uses named_scope if available; otherwise, it will 
accept a block or return find(:all) with applicable conditions applied


Example
=======

class Entry < ActiveRecord::Base
  acts_as_searchable :on => [:title, :body, "comments.body", "CONCAT(users.first_name, ' ', users.last_name)", 
  "users.login"], :include => [:comments, :user]
  
  belongs_to :user
  has_many :comments
end

# within console
Entry.search('Josh Clayton') #=> [<Entry>, <Entry>]
Entry.search('%ruby%') #=> [<Entry>, <Entry>, <Entry>]

=======

Copyright (c) 2008 Josh Clayton, released under the MIT license