rails_compatibility 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +62 -0
- data/.gitignore +0 -0
- data/.rubocop.yml +31 -32
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/LICENSE +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +5 -3
- data/Rakefile +0 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/gemfiles/3.2.gemfile +1 -1
- data/gemfiles/4.2.gemfile +1 -1
- data/gemfiles/5.0.gemfile +1 -1
- data/gemfiles/5.1.gemfile +1 -1
- data/gemfiles/5.2.gemfile +1 -1
- data/gemfiles/6.0.gemfile +1 -1
- data/gemfiles/6.1.gemfile +11 -0
- data/lib/rails_compatibility.rb +0 -0
- data/lib/rails_compatibility/active_record.rb +13 -0
- data/lib/rails_compatibility/attribute_types.rb +1 -1
- data/lib/rails_compatibility/build_joins.rb +44 -0
- data/lib/rails_compatibility/construct_join_dependency.rb +30 -0
- data/lib/rails_compatibility/unscope_where.rb +1 -1
- data/lib/rails_compatibility/version.rb +1 -1
- data/rails_compatibility.gemspec +0 -0
- metadata +8 -4
- data/.travis.yml +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b65886e174af9d71e8b04ed12969bc7d9564255eb4deb4dfaa7d2732ad1c3b46
|
4
|
+
data.tar.gz: f8af6e2aaa5c0dde135b98c054c524571bc06f97e56a29e371ebcb981098d966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd4cecb90bc3f668577338cff3d9571dc6386757644a9895aa2a2acd157f15faf3e97ee4c9fec60420f161533c2908d796d0fd4b491780b21bae399e6a61c9a
|
7
|
+
data.tar.gz: e862435b327c9baf0c7087dabf91a3e8079dc67ef833f9a1d12c92595965c4704e3a1aab106bc03ab5eac179e3c5fa840e53344f76fe6efec8dedeb573307167
|
@@ -0,0 +1,62 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths-ignore:
|
6
|
+
- 'README.md'
|
7
|
+
- 'CHANGELOG.md'
|
8
|
+
pull_request:
|
9
|
+
branches: [ master ]
|
10
|
+
paths-ignore:
|
11
|
+
- 'README.md'
|
12
|
+
- 'CHANGELOG.md'
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
test:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
name: Test
|
18
|
+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
ruby:
|
23
|
+
- 2.2
|
24
|
+
- 2.6
|
25
|
+
- 2.7
|
26
|
+
gemfile:
|
27
|
+
- 3.2.gemfile
|
28
|
+
- 4.2.gemfile
|
29
|
+
- 5.0.gemfile
|
30
|
+
- 5.1.gemfile
|
31
|
+
- 5.2.gemfile
|
32
|
+
- 6.0.gemfile
|
33
|
+
- 6.1.gemfile
|
34
|
+
exclude:
|
35
|
+
- gemfile: 3.2.gemfile
|
36
|
+
ruby: 2.6
|
37
|
+
- gemfile: 3.2.gemfile
|
38
|
+
ruby: 2.7
|
39
|
+
- gemfile: 4.2.gemfile
|
40
|
+
ruby: 2.7
|
41
|
+
- gemfile: 6.0.gemfile
|
42
|
+
ruby: 2.2
|
43
|
+
- gemfile: 6.1.gemfile
|
44
|
+
ruby: 2.2
|
45
|
+
env:
|
46
|
+
BUNDLE_GEMFILE: "gemfiles/${{ matrix.gemfile }}"
|
47
|
+
|
48
|
+
steps:
|
49
|
+
- name: Checkout
|
50
|
+
uses: actions/checkout@v2
|
51
|
+
- name: Setup Ruby
|
52
|
+
uses: ruby/setup-ruby@v1
|
53
|
+
with:
|
54
|
+
ruby-version: ${{ matrix.ruby }}
|
55
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
56
|
+
- name: Run tests
|
57
|
+
run: bundle exec rake
|
58
|
+
- name: Publish code coverage
|
59
|
+
if: ${{ success() }}
|
60
|
+
uses: paambaati/codeclimate-action@v2.7.5
|
61
|
+
env:
|
62
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rails
|
4
|
+
|
1
5
|
AllCops:
|
2
6
|
DisabledByDefault: true
|
3
7
|
Exclude: []
|
@@ -73,10 +77,6 @@ Layout/EndAlignment:
|
|
73
77
|
Description: 'Align ends correctly.'
|
74
78
|
Enabled: true
|
75
79
|
|
76
|
-
Lint/EndInMethod:
|
77
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
78
|
-
Enabled: true
|
79
|
-
|
80
80
|
Lint/EnsureReturn:
|
81
81
|
Description: 'Do not use return in an ensure block.'
|
82
82
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
|
@@ -90,7 +90,7 @@ Lint/FormatParameterMismatch:
|
|
90
90
|
Description: 'The number of parameters to format/sprint must match the fields.'
|
91
91
|
Enabled: true
|
92
92
|
|
93
|
-
Lint/
|
93
|
+
Lint/SuppressedException:
|
94
94
|
Description: "Don't suppress exception."
|
95
95
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
96
96
|
Enabled: true
|
@@ -139,7 +139,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
139
139
|
for block arguments or block local variables.
|
140
140
|
Enabled: true
|
141
141
|
|
142
|
-
Lint/
|
142
|
+
Lint/RedundantStringCoercion:
|
143
143
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
144
144
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
|
145
145
|
Enabled: true
|
@@ -148,7 +148,7 @@ Lint/UnderscorePrefixedVariableName:
|
|
148
148
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
149
149
|
Enabled: true
|
150
150
|
|
151
|
-
Lint/
|
151
|
+
Lint/RedundantCopDisableDirective:
|
152
152
|
Description: >-
|
153
153
|
Checks for rubocop:disable comments that can be removed.
|
154
154
|
Note: this cop is not disabled when disabling all cops.
|
@@ -221,7 +221,7 @@ Metrics/CyclomaticComplexity:
|
|
221
221
|
of test cases needed to validate a method.
|
222
222
|
Enabled: true
|
223
223
|
|
224
|
-
|
224
|
+
Layout/LineLength:
|
225
225
|
Description: 'Limit lines to 120 characters.'
|
226
226
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
227
227
|
Max: 120
|
@@ -285,7 +285,7 @@ Performance/ReverseEach:
|
|
285
285
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
286
286
|
Enabled: true
|
287
287
|
|
288
|
-
|
288
|
+
Style/Sample:
|
289
289
|
Description: >-
|
290
290
|
Use `sample` instead of `shuffle.first`,
|
291
291
|
`shuffle.last`, and `shuffle[Fixnum]`.
|
@@ -353,7 +353,7 @@ Rails/TimeZone:
|
|
353
353
|
Description: 'Checks the correct usage of time zone aware methods.'
|
354
354
|
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
355
355
|
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
356
|
-
Enabled:
|
356
|
+
Enabled: false
|
357
357
|
|
358
358
|
Rails/Validation:
|
359
359
|
Description: 'Use validates :attribute, hash of validations.'
|
@@ -375,21 +375,21 @@ Style/Alias:
|
|
375
375
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
|
376
376
|
Enabled: true
|
377
377
|
|
378
|
-
Layout/
|
378
|
+
Layout/ArrayAlignment:
|
379
379
|
Description: >-
|
380
380
|
Align the elements of an array literal if they span more than
|
381
381
|
one line.
|
382
382
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
|
383
383
|
Enabled: true
|
384
384
|
|
385
|
-
Layout/
|
385
|
+
Layout/HashAlignment:
|
386
386
|
Description: >-
|
387
387
|
Align the elements of a hash literal if they span more than
|
388
388
|
one line.
|
389
389
|
EnforcedHashRocketStyle: table
|
390
390
|
Enabled: true
|
391
391
|
|
392
|
-
Layout/
|
392
|
+
Layout/ParameterAlignment:
|
393
393
|
Description: >-
|
394
394
|
Align the parameters of a method call if they span more
|
395
395
|
than one line.
|
@@ -448,10 +448,6 @@ Style/BlockDelimiters:
|
|
448
448
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
449
449
|
Enabled: true
|
450
450
|
|
451
|
-
Style/BracesAroundHashParameters:
|
452
|
-
Description: 'Enforce braces style around hash parameters.'
|
453
|
-
Enabled: true
|
454
|
-
|
455
451
|
Style/CaseEquality:
|
456
452
|
Description: 'Avoid explicit use of the case equality operator(===).'
|
457
453
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
|
@@ -596,7 +592,7 @@ Style/EndBlock:
|
|
596
592
|
Layout/EndOfLine:
|
597
593
|
Description: 'Use Unix-style line endings.'
|
598
594
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
|
599
|
-
Enabled:
|
595
|
+
Enabled: false
|
600
596
|
|
601
597
|
Style/EvenOdd:
|
602
598
|
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
|
@@ -617,14 +613,14 @@ Layout/InitialIndentation:
|
|
617
613
|
Checks the indentation of the first non-blank non-comment line in a file.
|
618
614
|
Enabled: true
|
619
615
|
|
620
|
-
Layout/
|
616
|
+
Layout/FirstArgumentIndentation:
|
621
617
|
Description: 'Checks the indentation of the first parameter in a method call.'
|
622
618
|
Enabled: true
|
623
619
|
|
624
|
-
|
620
|
+
Lint/FlipFlop:
|
625
621
|
Description: 'Checks for flip flops'
|
626
622
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
|
627
|
-
Enabled:
|
623
|
+
Enabled: false
|
628
624
|
|
629
625
|
Style/For:
|
630
626
|
Description: 'Checks use of for or each in multiline loops.'
|
@@ -634,9 +630,12 @@ Style/For:
|
|
634
630
|
Style/FormatString:
|
635
631
|
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
636
632
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
|
637
|
-
EnforcedStyle:
|
633
|
+
EnforcedStyle: percent
|
638
634
|
Enabled: true
|
639
635
|
|
636
|
+
Style/FormatStringToken:
|
637
|
+
Enabled: false
|
638
|
+
|
640
639
|
Style/GlobalVars:
|
641
640
|
Description: 'Do not introduce global variables.'
|
642
641
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
|
@@ -676,14 +675,14 @@ Layout/IndentationWidth:
|
|
676
675
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
677
676
|
Enabled: true
|
678
677
|
|
679
|
-
Layout/
|
678
|
+
Layout/FirstArrayElementIndentation:
|
680
679
|
Description: >-
|
681
680
|
Checks the indentation of the first element in an array
|
682
681
|
literal.
|
683
682
|
EnforcedStyle: consistent
|
684
683
|
Enabled: true
|
685
684
|
|
686
|
-
Layout/
|
685
|
+
Layout/FirstHashElementIndentation:
|
687
686
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
688
687
|
EnforcedStyle: consistent
|
689
688
|
Enabled: true
|
@@ -862,7 +861,7 @@ Style/PercentQLiterals:
|
|
862
861
|
Style/PerlBackrefs:
|
863
862
|
Description: 'Avoid Perl-style regex back references.'
|
864
863
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
865
|
-
Enabled:
|
864
|
+
Enabled: false
|
866
865
|
|
867
866
|
Naming/PredicateName:
|
868
867
|
Description: 'Check the names of predicate methods.'
|
@@ -940,11 +939,11 @@ Style/SingleLineBlockParams:
|
|
940
939
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
|
941
940
|
Methods:
|
942
941
|
- reduce:
|
943
|
-
-
|
944
|
-
-
|
942
|
+
- sum
|
943
|
+
- v
|
945
944
|
- inject:
|
946
|
-
-
|
947
|
-
-
|
945
|
+
- sum
|
946
|
+
- v
|
948
947
|
Enabled: true
|
949
948
|
|
950
949
|
Style/SingleLineMethods:
|
@@ -1123,7 +1122,7 @@ Layout/Tab:
|
|
1123
1122
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
1124
1123
|
Enabled: true
|
1125
1124
|
|
1126
|
-
Layout/
|
1125
|
+
Layout/TrailingEmptyLines:
|
1127
1126
|
Description: 'Checks trailing blank lines and final newline.'
|
1128
1127
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
|
1129
1128
|
Enabled: true
|
@@ -1178,11 +1177,11 @@ Style/UnlessElse:
|
|
1178
1177
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
|
1179
1178
|
Enabled: true
|
1180
1179
|
|
1181
|
-
Style/
|
1180
|
+
Style/RedundantCapitalW:
|
1182
1181
|
Description: 'Checks for %W when interpolation is not needed.'
|
1183
1182
|
Enabled: true
|
1184
1183
|
|
1185
|
-
Style/
|
1184
|
+
Style/RedundantPercentQ:
|
1186
1185
|
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
1187
1186
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
|
1188
1187
|
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
## Change Log
|
2
2
|
|
3
|
+
### [v0.0.2](https://github.com/khiav223577/rails_compatibility/compare/v0.0.1...v0.0.2) 2019/12/18
|
4
|
+
- [#2](https://github.com/khiav223577/rails_compatibility/pull/2) Implement `attribute_types` (@khiav223577)
|
5
|
+
|
3
6
|
### v0.0.1 2019/12/17
|
4
7
|
- [#1](https://github.com/khiav223577/rails_compatibility/pull/1) Implement `unscope_where` (@khiav223577)
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# RailsCompatibility
|
2
2
|
|
3
3
|
[![Gem Version](https://img.shields.io/gem/v/rails_compatibility.svg?style=flat)](http://rubygems.org/gems/rails_compatibility)
|
4
|
-
[![Build Status](https://travis-ci.
|
4
|
+
[![Build Status](https://travis-ci.com/khiav223577/rails_compatibility/workflows/Ruby/badge.svg)](https://github.com/khiav223577/rails_compatibility/actions)
|
5
5
|
[![RubyGems](http://img.shields.io/gem/dt/rails_compatibility.svg?style=flat)](http://rubygems.org/gems/rails_compatibility)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/khiav223577/rails_compatibility/badges/gpa.svg)](https://codeclimate.com/github/khiav223577/rails_compatibility)
|
7
7
|
[![Test Coverage](https://codeclimate.com/github/khiav223577/rails_compatibility/badges/coverage.svg)](https://codeclimate.com/github/khiav223577/rails_compatibility/coverage)
|
8
8
|
|
9
|
+
## Supports
|
10
|
+
- Ruby 2.2 ~ 2.7
|
11
|
+
- Rails 3.2, 4.2, 5.0, 5.1, 5.2, 6.0
|
12
|
+
|
9
13
|
## Installation
|
10
14
|
|
11
15
|
Provides cross-rails methods for you to upgrade rails, backport features, create easy-to-maintain gems, and so on.
|
12
|
-
Support Rails 3.2, 4.2, 5.0, 5.1, 5.2, 6.0.
|
13
|
-
Support Ruby 2.2 ~ 2.6
|
14
16
|
|
15
17
|
```ruby
|
16
18
|
gem 'rails_compatibility'
|
data/Rakefile
CHANGED
File without changes
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/gemfiles/3.2.gemfile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/5.0.gemfile
CHANGED
data/gemfiles/5.1.gemfile
CHANGED
data/gemfiles/5.2.gemfile
CHANGED
data/gemfiles/6.0.gemfile
CHANGED
data/lib/rails_compatibility.rb
CHANGED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_compatibility'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
class << RailsCompatibility
|
7
|
+
GTE_RAILS_6_1 = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('6.1.0')
|
8
|
+
GTE_RAILS_6_0 = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('6.0.0')
|
9
|
+
GTE_RAILS_5_2 = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.2.0')
|
10
|
+
GTE_RAILS_5_1 = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.1.0')
|
11
|
+
GTE_RAILS_5_0 = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0.0')
|
12
|
+
GTE_RAILS_4_0 = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('4.0.0')
|
13
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rails_compatibility'
|
4
|
-
require 'active_record'
|
4
|
+
require 'rails_compatibility/active_record'
|
5
5
|
|
6
6
|
class << RailsCompatibility
|
7
7
|
if ActiveRecord::Base.respond_to?(:attribute_types) # column_types was changed to attribute_types in Rails 5
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_compatibility'
|
4
|
+
require 'rails_compatibility/construct_join_dependency'
|
5
|
+
require 'rails_compatibility/active_record'
|
6
|
+
|
7
|
+
class << RailsCompatibility
|
8
|
+
if GTE_RAILS_6_1
|
9
|
+
def build_joins(reflect, relation)
|
10
|
+
join_dependency = construct_join_dependency(reflect, relation)
|
11
|
+
joins = join_dependency.join_constraints([], relation.alias_tracker, relation.references_values)
|
12
|
+
return joins
|
13
|
+
end
|
14
|
+
elsif GTE_RAILS_6_0
|
15
|
+
def build_joins(reflect, relation)
|
16
|
+
join_dependency = construct_join_dependency(reflect, relation)
|
17
|
+
joins = join_dependency.join_constraints([], relation.alias_tracker)
|
18
|
+
return joins
|
19
|
+
end
|
20
|
+
elsif GTE_RAILS_5_2
|
21
|
+
def build_joins(reflect, relation)
|
22
|
+
join_dependency = construct_join_dependency(reflect, relation)
|
23
|
+
joins = join_dependency.join_constraints([], Arel::Nodes::InnerJoin, relation.alias_tracker)
|
24
|
+
return joins
|
25
|
+
end
|
26
|
+
elsif GTE_RAILS_5_0
|
27
|
+
def build_joins(reflect, relation)
|
28
|
+
join_dependency = construct_join_dependency(reflect, relation)
|
29
|
+
info = join_dependency.join_constraints([], Arel::Nodes::InnerJoin)[0]
|
30
|
+
return info.joins
|
31
|
+
end
|
32
|
+
elsif GTE_RAILS_4_0
|
33
|
+
def build_joins(reflect, relation)
|
34
|
+
join_dependency = construct_join_dependency(reflect, relation)
|
35
|
+
info = join_dependency.join_constraints([])[0]
|
36
|
+
return info.joins
|
37
|
+
end
|
38
|
+
else
|
39
|
+
def build_joins(reflect, relation)
|
40
|
+
join_dependency = construct_join_dependency(reflect, relation)
|
41
|
+
return join_dependency.join_associations
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_compatibility'
|
4
|
+
require 'rails_compatibility/active_record'
|
5
|
+
|
6
|
+
class << RailsCompatibility
|
7
|
+
if GTE_RAILS_6_0
|
8
|
+
def construct_join_dependency(reflect, relation)
|
9
|
+
association_joins = [reflect.active_record.table_name]
|
10
|
+
return relation.construct_join_dependency(association_joins, Arel::Nodes::InnerJoin)
|
11
|
+
end
|
12
|
+
elsif GTE_RAILS_5_2
|
13
|
+
def construct_join_dependency(reflect, relation)
|
14
|
+
association_joins = [reflect.active_record.table_name]
|
15
|
+
|
16
|
+
join_dependency = ActiveRecord::Associations::JoinDependency.new(reflect.klass, relation.table, association_joins)
|
17
|
+
|
18
|
+
root = join_dependency.send(:join_root)
|
19
|
+
|
20
|
+
join_dependency.instance_variable_set(:@alias_tracker, relation.alias_tracker)
|
21
|
+
join_dependency.send(:construct_tables!, root)
|
22
|
+
return join_dependency
|
23
|
+
end
|
24
|
+
else
|
25
|
+
def construct_join_dependency(reflect, _relation)
|
26
|
+
association_joins = [reflect.active_record.table_name]
|
27
|
+
return ActiveRecord::Associations::JoinDependency.new(reflect.klass, association_joins, [])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/rails_compatibility.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_compatibility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khiav reoy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,9 +108,9 @@ executables: []
|
|
108
108
|
extensions: []
|
109
109
|
extra_rdoc_files: []
|
110
110
|
files:
|
111
|
+
- ".github/workflows/ruby.yml"
|
111
112
|
- ".gitignore"
|
112
113
|
- ".rubocop.yml"
|
113
|
-
- ".travis.yml"
|
114
114
|
- CHANGELOG.md
|
115
115
|
- CODE_OF_CONDUCT.md
|
116
116
|
- LICENSE
|
@@ -125,8 +125,12 @@ files:
|
|
125
125
|
- gemfiles/5.1.gemfile
|
126
126
|
- gemfiles/5.2.gemfile
|
127
127
|
- gemfiles/6.0.gemfile
|
128
|
+
- gemfiles/6.1.gemfile
|
128
129
|
- lib/rails_compatibility.rb
|
130
|
+
- lib/rails_compatibility/active_record.rb
|
129
131
|
- lib/rails_compatibility/attribute_types.rb
|
132
|
+
- lib/rails_compatibility/build_joins.rb
|
133
|
+
- lib/rails_compatibility/construct_join_dependency.rb
|
130
134
|
- lib/rails_compatibility/unscope_where.rb
|
131
135
|
- lib/rails_compatibility/version.rb
|
132
136
|
- rails_compatibility.gemspec
|
@@ -154,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
158
|
- !ruby/object:Gem::Version
|
155
159
|
version: '0'
|
156
160
|
requirements: []
|
157
|
-
rubygems_version: 3.0.
|
161
|
+
rubygems_version: 3.0.6
|
158
162
|
signing_key:
|
159
163
|
specification_version: 4
|
160
164
|
summary: Provides cross-rails methods for you to upgrade rails, backport features,
|
data/.travis.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
env:
|
3
|
-
global:
|
4
|
-
- CC_TEST_REPORTER_ID=bc86bdb762b05f34d8c71dd53717ea5b3a83bda4b5a4ba684037d20076a186ec
|
5
|
-
language: ruby
|
6
|
-
rvm:
|
7
|
-
- 2.2
|
8
|
-
- 2.6
|
9
|
-
gemfile:
|
10
|
-
- gemfiles/3.2.gemfile
|
11
|
-
- gemfiles/4.2.gemfile
|
12
|
-
- gemfiles/5.0.gemfile
|
13
|
-
- gemfiles/5.1.gemfile
|
14
|
-
- gemfiles/5.2.gemfile
|
15
|
-
- gemfiles/6.0.gemfile
|
16
|
-
matrix:
|
17
|
-
exclude:
|
18
|
-
- gemfile: gemfiles/3.2.gemfile
|
19
|
-
rvm: 2.6
|
20
|
-
- gemfile: gemfiles/4.0.gemfile
|
21
|
-
rvm: 2.6
|
22
|
-
- gemfile: gemfiles/6.0.gemfile
|
23
|
-
rvm: 2.2
|
24
|
-
before_install:
|
25
|
-
- gem i rubygems-update -v '<3' && update_rubygems
|
26
|
-
- gem install bundler -v 1.17.3
|
27
|
-
- gem --version
|
28
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
29
|
-
- chmod +x ./cc-test-reporter
|
30
|
-
- ./cc-test-reporter before-build
|
31
|
-
script:
|
32
|
-
- bundle exec rake test
|
33
|
-
after_script:
|
34
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|