where_chain 0.2.2 → 0.2.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 +21 -4
  3. data/lib/where_chain/version.rb +1 -1
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abeb14aaed436d17d233cb280d30ad523c1dc23acd55e10ec52bae1c3209e1d4
4
- data.tar.gz: a9b751f6535f274589d6f086e57b3930555db2930ac6d3c3b31a4a3e932b567a
3
+ metadata.gz: 00b02560557c167de9ce11d97c1d0c9184579c753ca0e8b735d9b1734cc77317
4
+ data.tar.gz: 38dd58fcefd3dc9975b984b3742c558f74a59e813fb0f72a6dea6548ddeed0c2
5
5
  SHA512:
6
- metadata.gz: 5100bbd52f484e562ceded294c0bf1a6406e769c1ab8287d32673606a38891f085747bd440a3e80eadbf4b5f3ad64c2c2f75fbf005c5b829ba6f90cd8742a3a4
7
- data.tar.gz: f277a3d7a3d011051576245373631becbde0d4793f7beeb2e63582c0b974d55c17646d78dc4e13bd1ff960c77127daa44a3267aecacbc8ef18e10c4d3779bc76
6
+ metadata.gz: 2e19f7b633157d5a84a43c28b084cf2e2fc29e19d1a61fae14cf6951bf7619f751287099656ebd2b8504e79072a9a405735e1bece3d221d5622ef944a701f80f
7
+ data.tar.gz: 5e5b9cb231931d9949126eed5f365d69f6c1c9eccae6b87cc8e05d0a544d24373dd95d4630be5aef9a6a9ea3ef12d24f56dc3be5a7d05d30e1557486bd58a733
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # WhereChain
4
4
 
5
- In Rails, we usually use Active Record, which allows us to escape from writing SQL code like this `SELECT * FROM posts WHERE posts.name = 'Foo'` and allows us to write `Post.where(name: 'Foo')` instead. However, this has always been limited to matching equality, so you still have to write `Post.where('comments > ?', 5)` to get Posts that have more than 5 comments.
5
+ In Rails, we usually use Active Record, which allows us to escape from writing SQL code like this `SELECT * FROM posts WHERE posts.name = 'Foo'` and allows us to write `Post.where(name: 'Foo')` instead. However, this has always been limited to matching equality, so you still have to write `Post.where('comments > ?', 5)` to get Posts that have more than 5 comments.
6
6
 
7
7
  In the older versions, you also had to write `Post.where('name IS NOT null')` to do a negation. Rails 4.0 added a class called `WhereChain` that added some [new possibilities](https://github.com/rails/rails/commit/de75af7acc5c05c708443de40e78965925165217), one of which was a `not` method. The proper way to write became `Post.where.not(name: nil)` instead.
8
8
 
@@ -10,7 +10,7 @@ Within the same comment there were also two new methods that [didn't survive to
10
10
 
11
11
  This gem brings these two methods back and extends WhereChain with additional methods: `.gt`, `.gte`, `.lt` and `.lte`, so that by using it you can replace the SQL strings like `Post.where('comments > 5')` with `Post.where.gt(comments: 5)`.
12
12
 
13
- WhereChain depends on the Active Record gem in a version higher than 4.2, due to problems with Ruby versions lesser than 2.4. Rails 4.2 is already the version that's being maintained, so you probably should not use an earlier one anyway. The gem is tested on the latest Ruby and all current Rails versions - 4.2, 5.0, 5.1 and 5.2 RC 1.
13
+ WhereChain depends on the Active Record gem in a version higher than 4.2, due to problems with Ruby versions lesser than 2.4. Rails 4.2 is already the version that's being maintained, so you probably should not use an earlier one anyway. The gem is tested on the latest Ruby and all current Rails versions - 4.2, 5.0, 5.1 and 5.2.
14
14
 
15
15
  ## Usage
16
16
 
@@ -51,7 +51,7 @@ Post.where.gt(comments: { bad: :thing })
51
51
  ArgumentError: The value passed to this method should be a valid type.
52
52
 
53
53
  Post.where.gt('comments > ?', 5)
54
- Post.where.gt([{number: 5}, 'name > ?'], 'abc')
54
+ Post.where.gt([{ number: 5 }, 'name > ?'], 'abc')
55
55
 
56
56
  ArgumentError: This method requires a Hash as an argument.
57
57
  ```
@@ -79,7 +79,24 @@ $ gem install where_chain
79
79
  2. Create your feature branch (`git checkout -b my-new-feature`)
80
80
  3. Commit your changes (`git commit -am 'Added some feature'`)
81
81
  4. Push to the branch (`git push origin my-new-feature`)
82
- 5. Create new Pull Request
82
+ 5. Make sure all the tests pass on all versions
83
+ 6. Create new Pull Request
84
+
85
+ ## Testing the code
86
+
87
+ Running all the tests for all Rails version targets:
88
+
89
+ ```bash
90
+ $ bundle exec appraisal rspec
91
+ ```
92
+
93
+ Running tests for a specific version:
94
+
95
+ ```bash
96
+ $ bundle exec appraisal 5.0 rspec
97
+ ```
98
+
99
+ You can see all the targets to use instead of `5.0` in the `Appraisals` file.
83
100
 
84
101
  ## License
85
102
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,3 +1,3 @@
1
1
  module WhereChain
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_chain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Ruszkiewicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -139,7 +139,7 @@ files:
139
139
  - lib/active_record/where_chain_shared_methods.rb
140
140
  - lib/where_chain.rb
141
141
  - lib/where_chain/version.rb
142
- homepage: https://github.com/marcinruszkiewicz
142
+ homepage: https://github.com/marcinruszkiewicz/where_chain
143
143
  licenses:
144
144
  - MIT
145
145
  metadata: {}
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.7.3
162
+ rubygems_version: 2.7.6
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: 'WhereChain extensions - Model.where.lt(created_at: Date.today)'