Sha256: 0a37ab399ac64254b2da8c312444e0b4d326182959e0a719d140662005b16632
Contents?: true
Size: 1.89 KB
Versions: 4
Compression:
Stored size: 1.89 KB
Contents
# Filta Super simple filtering for ActiveRecord, inspired by [Justin Weiss' Gist](https://gist.github.com/justinweiss/9065666). [![Gem Version](https://badge.fury.io/rb/filta.svg)](https://badge.fury.io/rb/filta) [![CircleCI](https://circleci.com/gh/boxt/filta/tree/master.svg?style=svg)](https://circleci.com/gh/boxt/filta/tree/master) ## Installation Add this line to your application's Gemfile: ```ruby gem "filta" ``` And then execute: ```bash $ bundle ``` Or install it yourself as: ```bash $ gem install filta ``` ## Usage Use like you would any other kind of ActiveRecord scope. ```ruby @filtered = Klass.filta({ title: "Foo", something: "Bar" }) ``` The `filter` method returns an ActiveRecord relation so you can chain the calls with other methods. ```ruby Klass.filta({ title: "Foo" }).order("created_at DESC") ``` If using in a controller make sure you use the `params.permit` method to sanitise what you pass into the `filter` method. ## Notes The original `.filter` method is deprecated to avoid any confusion ## Contributing - Check out the latest master and/or develop branches to make sure the feature hasn't been implemented or the bug hasn't been fixed yet - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it - Fork the project - Start a feature/bugfix branch off of develop (using Git Flow approach) - Commit and push until you are happy with your contribution - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally - When you are done generate a pull request - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. ## 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 |
---|---|
filta-1.1.2 | README.md |
filta-1.1.1 | README.md |
filta-1.1.0 | README.md |
filta-1.0.0 | README.md |