activerecord_nested_scope 1.0.4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8e410ad54617ffeb9efb8f56397f72ace4642944
4
- data.tar.gz: 8c67e79ea1bd658e73637174c011bf6ab037539e
2
+ SHA256:
3
+ metadata.gz: 2237ccaba43cfd565b5889269d3e99914e754533dc778ab96be50e2f806d42c0
4
+ data.tar.gz: e68a3dde94705fafb79967d6b198e453acb5ea9b67581daa494eda9bdf18dbbc
5
5
  SHA512:
6
- metadata.gz: d280f90f2b40e2668406147cb2913654784e89685923a4b36cc1764530826c8c63ff3e698dbebea4ca53ef075ab7bf98e99a4097f22d4df819d2abdace93cc18
7
- data.tar.gz: 979cb3d3d2c9fdaef9cd6f5feb094eab90c94df90a1fb13703445056bec510134a9d50ccd448d4a2e7d8d693b0a532b817ebe93b3f6b6c7b194aabea27b0b91b
6
+ metadata.gz: ac09c60fb4aa092619f394b92c4defd63c34f92d384d75ce3b321136069f164e6d4d9b57b2f30d4aee5f9d9b00653a1c38cd6de1c2ed06c4a1ff720bfc85aa03
7
+ data.tar.gz: ce4815d93146dccf9ff8c252a22a164e76b0367133aa5ada5f014d5e3c96ec81aca336ae625fa39b030a9769750377d2c99dc606c40ea091f863fe29b438611c
@@ -0,0 +1,75 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-20.04
8
+ services:
9
+ postgres:
10
+ image: postgres:9.5
11
+ env:
12
+ POSTGRES_USER: postgres
13
+ POSTGRES_PASSWORD: postgres
14
+ ports:
15
+ - 5432:5432
16
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
17
+ mysql:
18
+ image: mysql:5.7
19
+ env:
20
+ MYSQL_ALLOW_EMPTY_PASSWORD: yes
21
+ ports:
22
+ - 3306:3306
23
+ options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1]
28
+ gemfile: ['rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70']
29
+ database: ['sqlite', 'mysql', 'postgresql']
30
+ exclude:
31
+ - ruby: 2.4
32
+ gemfile: rails60
33
+ - ruby: 2.4
34
+ gemfile: rails61
35
+ - ruby: 2.4
36
+ gemfile: rails70
37
+ - ruby: 2.5
38
+ gemfile: rails70
39
+ - ruby: 2.6
40
+ gemfile: rails70
41
+ - ruby: 3.0
42
+ gemfile: rails50
43
+ - ruby: 3.0
44
+ gemfile: rails51
45
+ - ruby: 3.0
46
+ gemfile: rails52
47
+ - ruby: 3.1
48
+ gemfile: rails50
49
+ - ruby: 3.1
50
+ gemfile: rails51
51
+ - ruby: 3.1
52
+ gemfile: rails52
53
+
54
+ name: ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}, ${{ matrix.database }}
55
+
56
+ env:
57
+ DATABASE: ${{ matrix.database }}
58
+ POSTGRES_USER: postgres
59
+ POSTGRES_PASSWORD: postgres
60
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
61
+
62
+ steps:
63
+ - uses: actions/checkout@v2
64
+ - uses: ruby/setup-ruby@v1
65
+ with:
66
+ ruby-version: ${{ matrix.ruby }}
67
+ bundler-cache: true
68
+ - name: Prepare test
69
+ run: |
70
+ cd spec/dummy
71
+ BUNDLE_GEMFILE=../../${{ env.BUNDLE_GEMFILE }} RAILS_ENV=test bundle exec rake db:create db:migrate db:seed
72
+ cd ../..
73
+ - name: Run test
74
+ run: |
75
+ DEBUG=1 bundle exec rspec
data/.gitignore CHANGED
@@ -4,12 +4,12 @@
4
4
  Gemfile.lock
5
5
  _yardoc/
6
6
  coverage/
7
+ gemfiles/*.lock
7
8
  doc/
8
9
  pkg/
9
10
  spec/reports/
10
11
  spec/dummy/config/database.yml
11
- spec/dummy/db/schema.rb
12
+ spec/dummy/db/schema*.rb
12
13
  spec/dummy/db/*.sqlite3
13
14
  spec/dummy/log/*.log
14
15
  spec/dummy/tmp/*
15
- tmp/
data/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # CHANGELOG
2
+
3
+ ## 1.3.0
4
+
5
+ * Drop support for ruby 2.3.
6
+
7
+ ## 1.2.0
8
+
9
+ * Add source_map option to resolve polymorphic type.
10
+
11
+ ## 1.1.1
12
+
13
+ * Fix query for associations with primary key option.
14
+
15
+ ## 1.1.0
16
+
17
+ * Add short query feature for simple belongs_to association.
18
+ * Rename `_nested_scope_options` to `nested_scope_options`.
19
+ * Remove support for active_record_union.
20
+
21
+ ## 1.0.4
22
+
23
+ * Fix query for string value.
24
+
25
+ ## 1.0.3
26
+
27
+ * Remove nil from polymorphic types.
28
+
29
+ ## 1.0.2
30
+
31
+ * Fix query error when there are no records in polymorphic tables.
32
+
33
+ ## 1.0.1
34
+
35
+ * Fix query for array value.
36
+
37
+ ## 1.0.0
38
+
39
+ * First release.
data/README.md CHANGED
@@ -4,8 +4,9 @@ An ActiveRecord extension to build nested scopes through pre-defined association
4
4
 
5
5
  ## Dependencies
6
6
 
7
- * ruby 2.3+
8
- * rails 5.0+ (activerecord and activesupport)
7
+ * ruby 2.4+
8
+ * activerecord 5.0+
9
+ * activesupport 5.0+
9
10
 
10
11
  ## Installation
11
12
 
@@ -57,35 +58,36 @@ UserConfig.in_group(id: 1)
57
58
 
58
59
  ### Polymorphic association
59
60
 
60
- If you define a polymorphic association like that,
61
+ If you define a polymorphic association,
62
+ `in_group` generates union of subqueries for each polymorpchic type as follows:
61
63
 
62
64
  ```ruby
63
- class Name < ActiveRecord::Base
64
- belongs_to :data, polymorphic: true
65
- nested_scope :in_group, through: :data
65
+ class Polymorphism < ActiveRecord::Base
66
+ belongs_to :record, polymorphic: true
67
+ nested_scope :in_group, through: :record
66
68
  end
67
- ```
68
-
69
- `in_group` scope generates union of subqueries for each polymorpchic type:
70
69
 
71
- ```ruby
72
- Name.in_group(id: 1)
73
- #=> SELECT "names"."data_type" FROM "names" GROUP BY "names"."data_type"
74
- # SELECT "names".* FROM (
75
- # SELECT "names".* FROM "names" WHERE "names"."data_type" = 'Group' AND "names"."data_id" IN (SELECT "groups"."id" FROM "groups" WHERE "groups"."id" = 1) UNION
76
- # SELECT "names".* FROM "names" WHERE "names"."data_type" = 'Manager' AND "names"."data_id" IN (SELECT "managers"."id" FROM "managers" WHERE "managers"."id" IN (SELECT "groups"."manager_id" FROM "groups" WHERE "groups"."id" = 1)) UNION
77
- # SELECT "names".* FROM "names" WHERE "names"."data_type" = 'Supervisor' AND "names"."data_id" IN (SELECT "supervisors"."id" FROM "supervisors" WHERE "supervisors"."id" IN (SELECT "managers"."supervisor_id" FROM "managers" WHERE "managers"."id" IN (SELECT "groups"."manager_id" FROM "groups" WHERE "groups"."id" = 1) ORDER BY "managers"."id" ASC)) UNION
78
- # SELECT "names".* FROM "names" WHERE "names"."data_type" = 'User' AND "names"."data_id" IN (SELECT "users"."id" FROM "users" WHERE "users"."group_id" IN (SELECT "groups"."id" FROM "groups" WHERE "groups"."id" = 1))) AS names
70
+ Polymorphism.in_group(id: 1)
71
+ #=> SELECT "polymorphisms"."record_type" FROM "polymorphisms" GROUP BY "polymorphisms"."record_type"
72
+ #=> SELECT "polymorphisms".* FROM (
73
+ # SELECT "polymorphisms".* FROM "polymorphisms" WHERE "polymorphisms"."record_type" = 'Group' AND "polymorphisms"."record_id" IN (SELECT "groups"."id" FROM "groups" WHERE "groups"."id" = 1) UNION
74
+ # SELECT "polymorphisms".* FROM "polymorphisms" WHERE "polymorphisms"."record_type" = 'User' AND "polymorphisms"."record_id" IN (SELECT "users"."id" FROM "users" WHERE "users"."group_id" IN (SELECT "groups"."id" FROM "groups" WHERE "groups"."id" = 1)) UNION
75
+ # SELECT "polymorphisms".* FROM "polymorphisms" WHERE "polymorphisms"."record_type" = 'UserConfig' AND "polymorphisms"."record_id" IN (SELECT "user_configs"."id" FROM "user_configs" WHERE "user_configs"."user_id" IN (SELECT "users"."id" FROM "users" WHERE "users"."group_id" IN (SELECT "groups"."id" FROM "groups" WHERE "groups"."id" = 1)))
76
+ # ) AS polymorphisms
79
77
  ```
80
78
 
81
- Note that the first SQL is executed to load `data_type`, and the second SQL is built using loaded `data_type` variations.
79
+ Note that the first SQL is executed to load `record_type`,
80
+ and the second SQL is built using loaded `record_type` variations.
82
81
 
83
- ### Scope examples
82
+ ### Scope arguments
84
83
 
85
84
  ```ruby
86
85
  # pass a integer
87
86
  User.in_group(1)
88
87
 
88
+ # pass an array
89
+ User.in_group([1, 2, 3])
90
+
89
91
  # pass a hash
90
92
  User.in_group(id: 1)
91
93
 
@@ -21,12 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "activesupport", ">= 5.0"
22
22
 
23
23
  spec.add_development_dependency "rails", ">= 5.0"
24
- spec.add_development_dependency "active_record_union"
25
24
  spec.add_development_dependency "mysql2"
26
25
  spec.add_development_dependency "pg"
27
26
  spec.add_development_dependency "sqlite3"
28
27
  spec.add_development_dependency "rspec-rails"
29
28
  spec.add_development_dependency "simplecov"
30
- spec.add_development_dependency "pry-rails"
31
- spec.add_development_dependency "pry-byebug"
32
29
  end
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "rails", "~> 5.0.0"
4
4
  gem "sqlite3", "~> 1.3.6"
5
- gem "mysql2", "~> 0.4.4"
5
+ gem "mysql2", "~> 0.5.0"
6
6
  gem "pg", "~> 0.18"
7
7
 
8
8
  gemspec path: "../"
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "rails", "~> 5.1.0"
4
4
  gem "sqlite3", "~> 1.3.6"
5
- gem "mysql2", "~> 0.4.4"
5
+ gem "mysql2", "~> 0.5.0"
6
6
  gem "pg", "~> 0.18"
7
7
 
8
8
  gemspec path: "../"
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "rails", "~> 5.2.0.rc1"
3
+ gem "rails", "~> 5.2.0"
4
+ gem "sqlite3", "~> 1.3.6"
4
5
 
5
6
  gemspec path: "../"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 6.0.0"
4
+ gem "psych", "~> 3.3.0"
5
+
6
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 6.1.0"
4
+
5
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 7.0.1"
4
+
5
+ gemspec path: "../"
@@ -1,97 +1,102 @@
1
1
  module ActiveRecordNestedScope
2
2
  class Builder
3
3
  def initialize(klass, name, args)
4
- @klass = klass
5
- @name = name
4
+ @node = Node.new(klass, name)
6
5
  @args = args
6
+ @args_type = args_type(args)
7
7
  end
8
8
 
9
- def build
10
- build_for(@klass)
9
+ def build(node = @node)
10
+ if node.leaf?
11
+ leaf_relation(node)
12
+ else
13
+ build_relation(node)
14
+ end
11
15
  end
12
16
 
13
17
  private
14
18
 
15
- def build_for(klass)
16
- if klass._nested_scope_options
17
- if (through = klass._nested_scope_options[@name][:through])
18
- if (ref = klass.reflect_on_association(through))
19
- build_relation(klass, ref)
20
- else
21
- raise ArgumentError.new("can't find reflection #{through} in #{klass}")
22
- end
23
- else
24
- root_relation(klass)
25
- end
19
+ def build_relation(node)
20
+ if node.has_many?
21
+ has_many_relation(node)
22
+ elsif node.polymorphic_belongs_to?
23
+ polymorphic_belongs_to_relation(node)
24
+ elsif node.belongs_to?
25
+ belongs_to_relation(node)
26
26
  else
27
- klass.none
27
+ raise ArgumentError.new("unsupported reflection: #{node.reflection} in #{node.klass}")
28
28
  end
29
29
  end
30
30
 
31
- def build_relation(klass, ref)
32
- case ref.class.to_s
33
- when 'ActiveRecord::Reflection::HasManyReflection', 'ActiveRecord::Reflection::HasOneReflection'
34
- has_many_relation(klass, ref)
35
- when 'ActiveRecord::Reflection::BelongsToReflection'
36
- if ref.polymorphic?
37
- belongs_to_polymorphic_relation(klass, ref)
38
- else
39
- belongs_to_relation(klass, ref)
40
- end
41
- else
42
- raise ArgumentError.new("unsupported reflection: #{ref} in #{klass}")
43
- end
31
+ def has_many_relation(node)
32
+ child = node.children.first
33
+ return node.klass.none unless child
34
+
35
+ relation = child_relation(child, select: node.reflection.foreign_key)
36
+ node.klass.where(node.reflection.active_record_primary_key => relation)
44
37
  end
45
38
 
46
- def has_many_relation(klass, ref)
47
- klass.where(klass.primary_key => build_for(ref.klass).merge(scoped(ref.klass, ref.scope)).select(ref.foreign_key))
39
+ def belongs_to_relation(node)
40
+ child = node.children.first
41
+ return node.klass.none unless child
42
+
43
+ relation = child_relation(child, select: node.reflection.active_record_primary_key)
44
+ node.klass.where(node.reflection.foreign_key => relation)
48
45
  end
49
46
 
50
- def belongs_to_relation(klass, ref)
51
- klass.where(ref.foreign_key => build_for(ref.klass).merge(scoped(ref.klass, ref.scope)).select(klass.primary_key))
47
+ def polymorphic_belongs_to_relation(node)
48
+ rels = node.children.map do |child|
49
+ relation = child_relation(child, select: child.klass.primary_key)
50
+ node.klass.where(
51
+ node.reflection.foreign_type => child.source_type,
52
+ node.reflection.foreign_key => relation
53
+ )
54
+ end
55
+
56
+ union(node.klass, rels)
52
57
  end
53
58
 
54
- def belongs_to_polymorphic_relation(klass, ref)
55
- types = klass.unscoped.group(ref.foreign_type).pluck(ref.foreign_type).compact
56
- if types.present?
57
- rels = types.map { |type|
58
- if (parent = type.safe_constantize)
59
- klass.where(ref.foreign_type => type, ref.foreign_key => build_for(parent).merge(scoped(parent, ref.scope)))
60
- else
61
- klass.none
62
- end
63
- }
64
- union(klass, rels)
59
+ def child_relation(child, select:)
60
+ if simple_leaf_relation?(child)
61
+ @args
65
62
  else
66
- klass.none
63
+ relation = build(child).select(select)
64
+ relation = relation.merge(child.scope) if child.has_scope?
65
+ relation
67
66
  end
68
67
  end
69
68
 
70
- def root_relation(klass)
71
- if @args.is_a?(ActiveRecord::Relation)
72
- klass.all.merge(@args)
73
- elsif @args.is_a?(Hash)
74
- klass.where(@args)
75
- elsif @args
76
- klass.where(klass.primary_key => @args)
69
+ def simple_leaf_relation?(child)
70
+ @args_type == :simple && child.leaf? && child.parent.belongs_to? && !child.has_scope?
71
+ end
72
+
73
+ def leaf_relation(node)
74
+ case @args_type
75
+ when :relation
76
+ node.klass.all.merge(@args)
77
+ when :hash
78
+ node.klass.where(@args)
79
+ when :simple
80
+ node.klass.where(node.klass.primary_key => @args)
77
81
  else
78
- klass.all
82
+ raise ArgumentError.new("unexpected argument type: #{@args_type}")
79
83
  end
80
84
  end
81
85
 
82
- def scoped(klass, scope)
83
- rel = klass.all
84
- rel = rel.instance_eval(&scope) if scope
85
- rel
86
+ def args_type(args)
87
+ if args.is_a?(ActiveRecord::Relation)
88
+ :relation
89
+ elsif args.is_a?(Hash)
90
+ :hash
91
+ else
92
+ :simple
93
+ end
86
94
  end
87
95
 
88
96
  def union(klass, rels)
89
- if defined? ActiveRecordUnion
90
- rels.reduce(:union)
91
- else
92
- union = rels.map { |rel| "#{rel.to_sql}" }.reject(&:empty?).join(' UNION ')
93
- klass.from(Arel.sql("(#{union}) AS #{klass.table_name}"))
94
- end
97
+ return klass.none if rels.blank?
98
+ union = rels.map { |rel| "#{rel.to_sql}" }.reject(&:empty?).join(' UNION ')
99
+ klass.from(Arel.sql("(#{union}) AS #{klass.table_name}"))
95
100
  end
96
101
  end
97
102
  end
@@ -1,4 +1,5 @@
1
1
  require 'active_support'
2
+ require_relative 'node'
2
3
  require_relative 'builder'
3
4
 
4
5
  module ActiveRecordNestedScope
@@ -6,13 +7,13 @@ module ActiveRecordNestedScope
6
7
  extend ActiveSupport::Concern
7
8
 
8
9
  included do
9
- class_attribute :_nested_scope_options
10
+ class_attribute :nested_scope_options
10
11
  end
11
12
 
12
13
  class_methods do
13
14
  def nested_scope(name, options = {})
14
- self._nested_scope_options ||= {}
15
- self._nested_scope_options[name] = options
15
+ self.nested_scope_options ||= {}
16
+ self.nested_scope_options[name] = options
16
17
 
17
18
  scope name, ->(args) {
18
19
  ActiveRecordNestedScope::Builder.new(self, name, args).build
@@ -0,0 +1,111 @@
1
+ module ActiveRecordNestedScope
2
+ class Node
3
+ attr_accessor :klass, :name, :parent, :source_type
4
+
5
+ def initialize(klass, name, parent = nil, source_type = nil)
6
+ @klass = klass
7
+ @name = name
8
+ @parent = parent
9
+ @source_type = source_type
10
+ end
11
+
12
+ def has_options?
13
+ options = @klass.nested_scope_options
14
+ options && options[@name]
15
+ end
16
+
17
+ def options(key)
18
+ options = @klass.nested_scope_options.to_h
19
+ options.dig(@name, key)
20
+ end
21
+
22
+ def reflection
23
+ @klass.reflect_on_association(options(:through))
24
+ end
25
+
26
+ def leaf?
27
+ options(:through).blank?
28
+ end
29
+
30
+ def has_many?
31
+ reflection.class.name.in?(['ActiveRecord::Reflection::HasManyReflection', 'ActiveRecord::Reflection::HasOneReflection'])
32
+ end
33
+
34
+ def belongs_to?
35
+ reflection.class.name == 'ActiveRecord::Reflection::BelongsToReflection' && !reflection.polymorphic?
36
+ end
37
+
38
+ def polymorphic_belongs_to?
39
+ reflection.class.name == 'ActiveRecord::Reflection::BelongsToReflection' && reflection.polymorphic?
40
+ end
41
+
42
+ def children
43
+ @children ||= search_children.select(&:valid?)
44
+ end
45
+
46
+ def search_children
47
+ if leaf?
48
+ []
49
+ elsif polymorphic_belongs_to?
50
+ types = PolymorphicType.new(self, reflection).resolve
51
+ types.map { |klass, source_type| Node.new(klass, @name, self, source_type) }
52
+ else
53
+ [Node.new(reflection.klass, @name, self)]
54
+ end
55
+ end
56
+
57
+ def valid?
58
+ return false unless has_options?
59
+
60
+ if options(:through) && !reflection
61
+ STDERR.puts "can't find reflection for #{options(:through)} in #{klass}"
62
+ return false
63
+ end
64
+
65
+ return true
66
+ end
67
+
68
+ def has_scope?
69
+ @parent && @parent.reflection.scope.present?
70
+ end
71
+
72
+ def scope
73
+ @klass.all.instance_eval(&@parent.reflection.scope) if has_scope?
74
+ end
75
+
76
+ class PolymorphicType
77
+ def initialize(node, reflection)
78
+ @node = node
79
+ @reflection = reflection
80
+ end
81
+
82
+ def resolve
83
+ types = @node.klass.unscoped.group(@reflection.foreign_type).pluck(@reflection.foreign_type).compact
84
+ types.map do |type|
85
+ klass = resolve_source_type(type)&.safe_constantize
86
+ [klass, type] if klass
87
+ end.compact
88
+ end
89
+
90
+ private
91
+
92
+ def resolve_source_type(type)
93
+ if (map = @node.options(:source_map))
94
+ resolve_from_map(type, map)
95
+ else
96
+ type
97
+ end
98
+ end
99
+
100
+ def resolve_from_map(type, map)
101
+ if map.is_a?(Proc)
102
+ map.call(type)
103
+ elsif map.is_a?(Hash)
104
+ map[type]
105
+ else
106
+ raise ArgumentError.new("unsupported argument type for source_map option: #{map.class}.")
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordNestedScope
2
- VERSION = '1.0.4'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_nested_scope
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: active_record_union
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: mysql2
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -136,34 +122,6 @@ dependencies:
136
122
  - - ">="
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: pry-rails
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: pry-byebug
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
125
  description: An ActiveRecord extension to build nested scopes through pre-defined
168
126
  associations
169
127
  email:
@@ -172,9 +130,10 @@ executables: []
172
130
  extensions: []
173
131
  extra_rdoc_files: []
174
132
  files:
133
+ - ".github/workflows/ci.yml"
175
134
  - ".gitignore"
176
135
  - ".rspec"
177
- - ".travis.yml"
136
+ - CHANGELOG.md
178
137
  - Gemfile
179
138
  - LICENSE
180
139
  - README.md
@@ -183,9 +142,13 @@ files:
183
142
  - gemfiles/rails50.gemfile
184
143
  - gemfiles/rails51.gemfile
185
144
  - gemfiles/rails52.gemfile
145
+ - gemfiles/rails60.gemfile
146
+ - gemfiles/rails61.gemfile
147
+ - gemfiles/rails70.gemfile
186
148
  - lib/activerecord_nested_scope.rb
187
149
  - lib/activerecord_nested_scope/builder.rb
188
150
  - lib/activerecord_nested_scope/extension.rb
151
+ - lib/activerecord_nested_scope/node.rb
189
152
  - lib/activerecord_nested_scope/railtie.rb
190
153
  - lib/activerecord_nested_scope/version.rb
191
154
  homepage: https://github.com/kanety/activerecord_nested_scope
@@ -206,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
169
  - !ruby/object:Gem::Version
207
170
  version: '0'
208
171
  requirements: []
209
- rubyforge_project:
210
- rubygems_version: 2.5.2.2
172
+ rubygems_version: 3.1.2
211
173
  signing_key:
212
174
  specification_version: 4
213
175
  summary: An ActiveRecord extension to build nested scopes
data/.travis.yml DELETED
@@ -1,25 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- - 2.5
6
- services:
7
- - mysql
8
- - postgresql
9
- addons:
10
- postgresql: "9.5"
11
- env:
12
- - DATABASE=sqlite
13
- - DATABASE=mysql
14
- - DATABASE=postgresql
15
- gemfile:
16
- - gemfiles/rails50.gemfile
17
- - gemfiles/rails51.gemfile
18
- - gemfiles/rails52.gemfile
19
- before_script:
20
- - cd spec/dummy
21
- - bundle exec rake db:create RAILS_ENV=test
22
- - bundle exec rake db:migrate RAILS_ENV=test
23
- - bundle exec rake db:seed RAILS_ENV=test
24
- - cd ../..
25
- script: bundle exec rspec