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 +4 -4
- data/CHANGES.md +3 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/order_query/nulls_direction.rb +10 -1
- data/lib/order_query/version.rb +1 -1
- data/spec/gemfiles/rails_6_0.gemfile +2 -2
- data/spec/gemfiles/rails_6_1.gemfile +21 -0
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b0284712fbd8e451e7bb4f41a81dc410c8141bc6e3d670dae192e02565bfb9f
|
4
|
+
data.tar.gz: 6b76ba2002e94c9f320f124ac4ba12bf786e213f9f7fcbcae20ae47402054dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddae4f82c3df302d84d2a7402aa5cc0aa2e6b4706a6d104b296ab5a33d036a121839fd01f42291364cc83347cc63e4a25e6776cbf776cf7e9c3e307818919f79
|
7
|
+
data.tar.gz: c1887c00922ab788bf659111e8ac55f7843c7a6dadfdf2d7948ca5ca1dd08a272142658e735c276d1b54c02b2fefb1d8fda1ebe49498d54cd76bc35435bda12a
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -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
|
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
|
data/lib/order_query/version.rb
CHANGED
@@ -4,8 +4,8 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
gemspec path: '../../'
|
6
6
|
|
7
|
-
gem 'activerecord', '~>
|
8
|
-
gem 'activesupport', '~>
|
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.
|
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:
|
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: '
|
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: '
|
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.
|
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/
|
153
|
-
- spec/gemfiles/
|
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
|