where_chain 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/where_chain/version.rb +1 -1
- data/lib/where_chain.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f315aba4854b20ae2812b304d2906b9b4bc2a16404e8336a4926d1e364bc9a6b
|
4
|
+
data.tar.gz: c1a2a55ec5d75bfef9c61909e4905078d646eab19e419bcbc711fe81a71bcbe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 118a919aff9dce62d3da888ef9b9777172a0561c29363be8fa6ef933992ef6ac1dbaa974624b454e6fb2ca4d4b47be05f90e5569b6f4fba609f955a15388a958
|
7
|
+
data.tar.gz: 5cec6db9307eb606116ccf741bff57fbae5b38953f6fb6a689db52b7b50ff0be7492f768f6146d7546f574ed929be515cc00543e4d8f25d1d52651742213055c
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/where_chain.svg)](https://badge.fury.io/rb/where_chain)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/where_chain.svg)](https://badge.fury.io/rb/where_chain) ![TravisCI](https://github.com/marcinruszkiewicz/where_chain/actions/workflows/rspec.yml/badge.svg)
|
2
2
|
|
3
3
|
# WhereChain
|
4
4
|
|
@@ -6,11 +6,11 @@ In Rails, we usually use Active Record, which allows us to escape from writing S
|
|
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
|
|
9
|
-
Within the same commit there were also two new methods that [didn't survive to the release of Rails 4.0](https://github.com/rails/rails/commit/8d02afeaee8993bd0fde69687fdd9bf30921e805) - `.like` and `.not_like`. As you can read in this commit discussion, there has been work made to bring them back, like the [activerecord-like](https://github.com/ReneB/activerecord-like) gem or [Squeel](https://github.com/activerecord-hackery/squeel), but these
|
9
|
+
Within the same commit there were also two new methods that [didn't survive to the release of Rails 4.0](https://github.com/rails/rails/commit/8d02afeaee8993bd0fde69687fdd9bf30921e805) - `.like` and `.not_like`. As you can read in this commit discussion, there has been work made to bring them back, like the [activerecord-like](https://github.com/ReneB/activerecord-like) gem or [Squeel](https://github.com/activerecord-hackery/squeel), but these have their own problems - activerecord-like only adds `.like` and `.not_like` back and the latest version is locked to Active Record 5; and Squeel provides a whole new query DSL, which not everyone will like. There was actually a pull request adding `.gt` and other [inequality methods](https://github.com/rails/rails/pull/8453), which was closed even faster than the first one.
|
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
|
13
|
+
WhereChain depends on the Active Record gem in a version higher than 4.2. The gem is tested on the latest Ruby and all current Rails versions - 5.2, 6.0, 6.1, and 7.0. If you have an older version, it will probably still work, because Active Record doesn't really change all that often, but Rails versions older than 5.2 depend on old and unsupported Ruby versions, so I'm not making any promises there.
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
@@ -99,10 +99,10 @@ $ bundle exec appraisal rspec
|
|
99
99
|
Running tests for a specific version:
|
100
100
|
|
101
101
|
```bash
|
102
|
-
$ bundle exec appraisal
|
102
|
+
$ bundle exec appraisal 7.0 rspec
|
103
103
|
```
|
104
104
|
|
105
|
-
You can see all the targets to use instead of `
|
105
|
+
You can see all the targets to use instead of `7.0` in the `Appraisals` file.
|
106
106
|
|
107
107
|
## License
|
108
108
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/where_chain/version.rb
CHANGED
data/lib/where_chain.rb
CHANGED
@@ -5,6 +5,6 @@ require 'active_record/where_chain_shared_methods'
|
|
5
5
|
# Active Record changed a lot in Rails 5 and 4 is still supported
|
6
6
|
if ActiveRecord::VERSION::MAJOR == 4
|
7
7
|
require 'active_record/where_chain_extensions_rails4'
|
8
|
-
elsif ActiveRecord::VERSION::MAJOR
|
8
|
+
elsif ActiveRecord::VERSION::MAJOR >= 5
|
9
9
|
require 'active_record/where_chain_extensions_rails5'
|
10
10
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Ruszkiewicz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: combustion
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.4'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: factory_bot_rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec_junit_formatter
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rspec-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: '1.4'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: '1.4'
|
139
139
|
description: |
|
140
140
|
This is a Rails plugin that extends Active Record with additional methods: .like, .unlike,
|
141
141
|
.gt, .gte, .lt and .lte, so that you can replace the SQL strings like
|
@@ -158,7 +158,7 @@ homepage: https://github.com/marcinruszkiewicz/where_chain
|
|
158
158
|
licenses:
|
159
159
|
- MIT
|
160
160
|
metadata: {}
|
161
|
-
post_install_message:
|
161
|
+
post_install_message:
|
162
162
|
rdoc_options: []
|
163
163
|
require_paths:
|
164
164
|
- lib
|
@@ -173,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
|
-
rubygems_version: 3.
|
177
|
-
signing_key:
|
176
|
+
rubygems_version: 3.5.10
|
177
|
+
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: 'WhereChain extensions - Model.where.lt(created_at: Date.today)'
|
180
180
|
test_files: []
|