order_query 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 140bea826457d9ad046a701da89e0073ca15f6631d3e996b5b44ba01fc7a7910
4
- data.tar.gz: aae7c51f4c0c607455b92efa36ca71c2df86b0b7b49c022a94bb209452a6bc4e
3
+ metadata.gz: 6b0284712fbd8e451e7bb4f41a81dc410c8141bc6e3d670dae192e02565bfb9f
4
+ data.tar.gz: 6b76ba2002e94c9f320f124ac4ba12bf786e213f9f7fcbcae20ae47402054dce
5
5
  SHA512:
6
- metadata.gz: f3c6db46a213cd3acc4cddc7f9f35247ec7ac6c986005b2d4e9185128b2f8c12ec585230c879e5a911c9c4ff097b00eda7dd530f04f78e242715c0bcda27ed5d
7
- data.tar.gz: 6171c2a35660bb8595bfae88e159cb65cafb93039ebd032b8257d5564e99dbedf51c6044d78df8382497b1d74c6a2493a155647ba7c68115c925a6fb2bf1a8a1
6
+ metadata.gz: ddae4f82c3df302d84d2a7402aa5cc0aa2e6b4706a6d104b296ab5a33d036a121839fd01f42291364cc83347cc63e4a25e6776cbf776cf7e9c3e307818919f79
7
+ data.tar.gz: c1887c00922ab788bf659111e8ac55f7843c7a6dadfdf2d7948ca5ca1dd08a272142658e735c276d1b54c02b2fefb1d8fda1ebe49498d54cd76bc35435bda12a
data/CHANGES.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.5.1
2
+
3
+ * Rails 6.1 now supported.
1
4
  ## 0.5.0
2
5
 
3
6
  * Rails 6 now supported.
data/Gemfile CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- eval_gemfile 'spec/gemfiles/rails_6_0.gemfile'
5
+ eval_gemfile 'spec/gemfiles/rails_6_1.gemfile'
6
6
  eval_gemfile 'rubocop.gemfile'
data/README.md CHANGED
@@ -11,7 +11,7 @@ This gem finds the next or previous record(s) relative to the current one effici
11
11
  Add to Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'order_query', '~> 0.5.0'
14
+ gem 'order_query', '~> 0.5.1'
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -32,7 +32,7 @@ module OrderQuery
32
32
  # @return [:first, :last] the default nulls order, based on the given
33
33
  # scope's connection adapter name.
34
34
  def default(scope, dir)
35
- case scope.connection_config[:adapter]
35
+ case connection_adapter(scope)
36
36
  when /mysql|maria|sqlite|sqlserver/i
37
37
  (dir == :asc ? :first : :last)
38
38
  else
@@ -40,5 +40,14 @@ module OrderQuery
40
40
  (dir == :asc ? :last : :first)
41
41
  end
42
42
  end
43
+
44
+ def connection_adapter(scope)
45
+ if scope.respond_to?(:connection_db_config)
46
+ # Rails >= 6.1.0
47
+ scope.connection_db_config.adapter
48
+ else
49
+ scope.connection_config[:adapter]
50
+ end
51
+ end
43
52
  end
44
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OrderQuery
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
@@ -4,8 +4,8 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec path: '../../'
6
6
 
7
- gem 'activerecord', '~> 5.2.3'
8
- gem 'activesupport', '~> 5.2.3'
7
+ gem 'activerecord', '~> 6.0.3'
8
+ gem 'activesupport', '~> 6.0.3'
9
9
 
10
10
  platforms :mri, :rbx do
11
11
  # https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L13
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec path: '../../'
6
+
7
+ gem 'activerecord', '~> 6.1.1'
8
+ gem 'activesupport', '~> 6.1.1'
9
+
10
+ platforms :mri, :rbx do
11
+ # https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L13
12
+ gem 'sqlite3', '~> 1.4'
13
+
14
+ # https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L4
15
+ gem 'pg', '>= 0.18', '< 2.0'
16
+
17
+ # https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6
18
+ gem 'mysql2', '>= 0.4.4'
19
+ end
20
+
21
+ eval_gemfile '../../shared.gemfile'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: order_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Mazovetskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-27 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -56,14 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '10.2'
59
+ version: '13.0'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '10.2'
66
+ version: '13.0'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: rspec
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -118,6 +118,7 @@ files:
118
118
  - spec/gemfiles/rails_5_1.gemfile
119
119
  - spec/gemfiles/rails_5_2.gemfile
120
120
  - spec/gemfiles/rails_6_0.gemfile
121
+ - spec/gemfiles/rails_6_1.gemfile
121
122
  - spec/gemfiles/rubocop.gemfile
122
123
  - spec/order_query_spec.rb
123
124
  - spec/spec_helper.rb
@@ -142,16 +143,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
- rubygems_version: 3.0.6
146
+ rubygems_version: 3.1.2
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Find next / previous Active Record(s) in one query
149
150
  test_files:
150
- - spec/order_query_spec.rb
151
151
  - spec/spec_helper.rb
152
- - spec/support/order_expectation.rb
153
- - spec/gemfiles/rails_5_1.gemfile
152
+ - spec/order_query_spec.rb
153
+ - spec/gemfiles/rails_6_1.gemfile
154
154
  - spec/gemfiles/rails_5_2.gemfile
155
- - spec/gemfiles/rubocop.gemfile
156
- - spec/gemfiles/rails_5_0.gemfile
157
155
  - spec/gemfiles/rails_6_0.gemfile
156
+ - spec/gemfiles/rails_5_0.gemfile
157
+ - spec/gemfiles/rails_5_1.gemfile
158
+ - spec/gemfiles/rubocop.gemfile
159
+ - spec/support/order_expectation.rb