Sha256: 06d594a1447d11765451b0642378600cf6c6ebfd53a15483d751503713da531b

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 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 install

## Usage

To install the search functionality not using Devise, type the command:

	$ search:install

To install the search functionality using Devise, type the command:

	$ search:install:devise

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 -%>
```


If you are not using Devise, 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
```

If you are using Devise, 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_user_id(current_user.id)
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.


## 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

2 entries across 2 versions & 1 rubygems

Version Path
search_rails-1.1.3 README.md
search_rails-1.1.2 README.md