Simply Searchable plugin

Plugin details

The main goal of SimplySearchable is to help you create a clean url to search in your controller and model.

Websitehttp://code.spinbits.com/simply_searchable.html Repositorysvn://code.spinbits.com/plugins/simply_searchable/trunk Tags Search LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install svn://code.spinbits.com/plugins/simply_searchable/trunk

In your PostsController add:

simply_searchable :fields => ['title', 'author_id', 'comments']



In your routes.rb add search method to your desired resource:

map.resources :posts, :collection => {:search => :get}



Generate the search results page that shows the post's title and body:

ruby script/generate simply_searchable Post title body



visit /posts/search and start passing your filters:

/posts/search?author_id=1				  # View posts from author 1
/posts/search?title="test"				  # View posts with the title 'test'
/posts/search?comments=1&author_id=3	  # View posts that has comment 1 and written by author 3
/posts/search?author_id[]=1&author_id[]=2 # View posts from both authors 1 and 2

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (2 older versions) | Last edited by: scott, 8 months ago