tomgi / acts_as_finder

Home Page:https://rubygems.org/gems/acts_as_finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ActsAsFinder

This acts_as extension provides the capabilities for beautiful record finding by specified column(s).

Installation

Add this line to your application's Gemfile:

gem 'acts_as_finder'

And then execute:

$ bundle

Or install it yourself as:

$ gem install acts_as_finder

Example Usage

Assume you have following model:

class Language < ActiveRecord::Base
  acts_as_finder :short_name, :name
end

And records in database:

+----+------------+---------+
| id | short_name | name    |
+----+------------+---------+
| 1  | EN         | English |
| 2  | PL         | Polish  |
+----+------------+---------+

Now you can use this extension like this:

>> Language.EN
=> #<Language id: 1, short_name: "EN", name: "English"> 

>> Language.Polish
=> #<Language id: 2, short_name: "PL", name: "Polish">

Build Status

Build Status

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. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

About

https://rubygems.org/gems/acts_as_finder

License:MIT License


Languages

Language:Ruby 100.0%