filta 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -11
  3. data/VERSION +1 -0
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc34f7efbbf6feb66689560ffccbaf7bca8d1e83
4
- data.tar.gz: 231d66d87ff55f49eb73056fcdc478c5344b6763
3
+ metadata.gz: 74678867ff216b42dafc4dba3c6a120c9629bf76
4
+ data.tar.gz: 6f95ad0efdf27639ee12aa0d379d7561f7410049
5
5
  SHA512:
6
- metadata.gz: 25bed89dd3ba7f78310aee7db5c989e02b3368e5ae95fb3adf0b4c3e9fb02866810541339f8881d302d12e7792863edb737bbccb4bd54bf77c42c1e708296ff4
7
- data.tar.gz: 30db3e608cc2e9733fca78859abbda449a26de13a097f7beed2f7a11f568d279dcfd8da02a42d84efcd297556ba1327c85395286f13ddccb752aa11809974ccf
6
+ metadata.gz: a40b5bce4dfd98b052c8eb6d3ff3af40f3de109b54bcdd977b6dd4dead025c7a579a25b4648b58b4d7b410d283f8e66b215f2ea54ab8ed196e3f2ad291dd8a6c
7
+ data.tar.gz: f5fcc1069ef123773b71a1cd14f56f8b4a8d77dd7aa8767eb68532dec67077a764a31a1a342ecfe82128d688b040c31c8ad725ad1f6a6af38d0af04766e9bf6a
data/README.md CHANGED
@@ -2,26 +2,24 @@
2
2
 
3
3
  Super simple filtering for ActiveRecord, inspired by [Justin Weiss' Gist](https://gist.github.com/justinweiss/9065666).
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/filta.svg)](https://badge.fury.io/rb/filta)
6
+ [![Build Status](https://secure.travis-ci.org/sleepingstu/filta.png)](http://travis-ci.org/sleepingstu/filta)
7
+
5
8
  <!-- MarkdownTOC -->
6
9
 
7
- - [Usage](#usage)
8
10
  - [Installation](#installation)
11
+ - [Usage](#usage)
9
12
  - [Contributing](#contributing)
10
13
  - [License](#license)
11
- - [TODO](#todo)
12
14
 
13
15
  <!-- /MarkdownTOC -->
14
16
 
15
- ## Usage
16
-
17
- TBC
18
-
19
17
  ## Installation
20
18
 
21
19
  Add this line to your application's Gemfile:
22
20
 
23
21
  ```ruby
24
- gem 'filta'
22
+ gem "filta"
25
23
  ```
26
24
 
27
25
  And then execute:
@@ -36,6 +34,23 @@ Or install it yourself as:
36
34
  $ gem install filta
37
35
  ```
38
36
 
37
+ ## Usage
38
+
39
+ Use like you would any other kind of ActiveRecord scope.
40
+
41
+ ```ruby
42
+ @filtered = Klass.filter({ title: "Foo", something: "Bar" })
43
+ ```
44
+
45
+ The `filter` method returns an ActiveRecord relation so you can chain the calls with other methods.
46
+
47
+ ```ruby
48
+ Klass.filter({ title: "Foo" }).order("created_at DESC")
49
+ ```
50
+
51
+ If using in a controller make sure you use the `params.permit` method to sanitise what you pass into the `filter` method.
52
+
53
+
39
54
  ## Contributing
40
55
 
41
56
  * 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
@@ -50,7 +65,3 @@ $ gem install filta
50
65
  ## License
51
66
 
52
67
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
53
-
54
- ## TODO
55
-
56
- * Finish README
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Chinery
@@ -77,6 +77,7 @@ files:
77
77
  - MIT-LICENSE
78
78
  - README.md
79
79
  - Rakefile
80
+ - VERSION
80
81
  - lib/filta.rb
81
82
  - lib/filta/methods.rb
82
83
  - lib/filta/version.rb