Sha256: d08b09810b4d5e09e4b35a9e242b2e6f81251c5cd24b4c985657e7203aa7f99d

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

# SearchRails

A Simple Search Gem For Ruby On Rails

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'search_rails'
gem 'colorize'
```

And then execute:

    $ bundle

## Usage

To install the search functionality, type the command:

	$ search:install

Then follow the steps below.

The syntax for installing the search function is shown in the example below,
as if you are installing it for the table 'humans' and the attributes 'name' (string) and 'age' (integer):
	
	$ install humans name:string age:integer

After that run:
	
	$ rake db:migrate

Then insert the following form on whatever page you have set up for the search function:

```ruby
<%= form_for @search do |f| %>
  <%= f.text_field :search %>
  <%= link_to 'x', clear_search_path(@search) %>
<% end -%>
```


Then add the following lines to whatever controller action you want to have the search functionality in.

```ruby
$LOAD_PATH.unshift(File.dirname('../app/search'))
extend SearchModule
@search = Search.find_by_search_id(1)
if @search.search != nil
  search()
end
```

This is still a work in progress, so if there are any issues, please report them on the GitHub page.

#### Hopefully in the future, automatic support for Devise will be included, but for now, you will have to modify the files 'search:install' makes on your own for devise or multi-user use.


## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/micahnico/search_rails.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
search_rails-1.1.1 README.md
search_rails-1.1.0 README.md
search_rails-1.0.9 README.md
search_rails-1.0.8 README.md