Sha256: d6e0747ddec56b4798136a7ac54b30330c35b1dbaeea68f5f7fd5e4b356ba438

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# BarelySearchable

This is a bare-bones almost functional "search" ability for your model layer.

It adds `.search` to your models which builds out a simple `LIKE OR` query to search your models and requires no external service to index the your tables or any index tables.

It is a terrible and slow search engine....but it'll probably work for a handful of use cases until you quit being lazy and install Sphinx.

## Installation

Add this line to your application's Gemfile: `gem 'barely_searchable'`

## Usage

In your model:

```
class User < ActiveRecord::Base
  #define the fields it'll search on
  searches_on :id, :username, :email, :first_name, :last_name
end
```

Now elsewhere in your application:

```
  def search_users
    @users = User.search 'user@domain.com'
  end
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
barely_searchable-0.0.1 README.md