edge_rider 2.3.0 → 2.3.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: 33202d76dc67a93b07083b49b163fbb330d023564050e4db51c5e630aafc6e85
4
- data.tar.gz: bb0bd9164292042276bb4be32b7378e96fbcc4032da04941fa5ae3a2c0dbc8ab
3
+ metadata.gz: 32bfec9bfa5c200e32346b737cab2a2ca8022a7970592b545ea441d18fc7cb1e
4
+ data.tar.gz: 27a7901e4a45da9e8c82672b4c94157a811308a85fbef9bda063c2c8854bbf3a
5
5
  SHA512:
6
- metadata.gz: f4844a44d8ba640e873052515d1cb1635f5c08240090cdfb0ee7bf75e3320bf45e6ad482a9984dd630d2e5dd574dc25714b7b510b8a24b68912a8430ed90dcc7
7
- data.tar.gz: 45ded01f3ca6dfde897838995cb990e16159b9eb2a68dba2769960bf34af5d18e52c7808853a70e0c126d55f086e3b5bc39c9b56b11f8ef119d75ca0a8f45a38
6
+ metadata.gz: 56a14c1c14b1385eeacbea770151e82237fda1b0c80e3b774127f47dfc97ebda0886e455a60958784e6d65c07b7da52902b4f88311b376c2b7ea8b6b490e1428
7
+ data.tar.gz: bbda66b48e74e0515b38b1959d1836a77aced98bdb90778d215698a3886c88828edcc7ab0463ce40ffbcfd757addf534fb3690508dfad155aac51557003a9208
data/CHANGELOG.md CHANGED
@@ -9,6 +9,13 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
9
9
 
10
10
  ### Compatible changes
11
11
 
12
+
13
+ ## 2.3.1 - 2024-10-18
14
+
15
+ ### Compatible changes
16
+
17
+ - Follow recommended way to extend Railties
18
+
12
19
  ## 2.3.0 - 2023-05-26
13
20
 
14
21
  ### Compatible changes
data/Gemfile CHANGED
@@ -1 +1 @@
1
- ./Gemfile.6.1.pg
1
+ Gemfile.6.1.pg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edge_rider (2.3.0)
4
+ edge_rider (2.3.1)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
data/Gemfile.4.2.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edge_rider (2.3.0)
4
+ edge_rider (2.3.1)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edge_rider (2.3.0)
4
+ edge_rider (2.3.1)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -76,4 +76,4 @@ DEPENDENCIES
76
76
  rspec
77
77
 
78
78
  BUNDLED WITH
79
- 2.3.4
79
+ 2.3.26
data/Gemfile.5.2.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edge_rider (2.3.0)
4
+ edge_rider (2.3.1)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -76,4 +76,4 @@ DEPENDENCIES
76
76
  rspec
77
77
 
78
78
  BUNDLED WITH
79
- 2.3.4
79
+ 2.3.26
data/Gemfile.6.1.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edge_rider (2.3.0)
4
+ edge_rider (2.3.1)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
data/Gemfile.7.0.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edge_rider (2.3.0)
4
+ edge_rider (2.3.1)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -75,4 +75,4 @@ DEPENDENCIES
75
75
  rspec
76
76
 
77
77
  BUNDLED WITH
78
- 2.3.4
78
+ 2.3.13
data/Gemfile.lock CHANGED
@@ -1 +1 @@
1
- ./Gemfile.6.1.pg.lock
1
+ Gemfile.6.1.pg.lock
@@ -16,7 +16,9 @@ module EdgeRider
16
16
  scope.pluck(qualified_column_name)
17
17
  end
18
18
 
19
- ActiveRecord::Base.extend(self)
20
-
21
19
  end
22
20
  end
21
+
22
+ ActiveSupport.on_load :active_record do
23
+ extend(EdgeRider::CollectColumn)
24
+ end
@@ -36,8 +36,6 @@ module EdgeRider
36
36
 
37
37
  end
38
38
 
39
- ::ActiveRecord::Base.send(:include, ActiveRecordValue)
40
-
41
39
  module ActiveRecordScope
42
40
 
43
41
  def collect_ids
@@ -46,10 +44,6 @@ module EdgeRider
46
44
 
47
45
  end
48
46
 
49
- ::ActiveRecord::Base.send(:extend, ActiveRecordScope)
50
- ::ActiveRecord::Associations::HasManyAssociation.send(:include, ActiveRecordScope)
51
- ::ActiveRecord::Associations::HasManyThroughAssociation.send(:include, ActiveRecordScope)
52
-
53
47
  module Integer
54
48
 
55
49
  def collect_ids
@@ -62,3 +56,10 @@ module EdgeRider
62
56
 
63
57
  end
64
58
  end
59
+
60
+ ActiveSupport.on_load :active_record do
61
+ extend(EdgeRider::CollectIds::ActiveRecordScope)
62
+ include(EdgeRider::CollectIds::ActiveRecordValue)
63
+ ActiveRecord::Associations::HasManyAssociation.send(:include, EdgeRider::CollectIds::ActiveRecordScope)
64
+ ActiveRecord::Associations::HasManyThroughAssociation.send(:include, EdgeRider::CollectIds::ActiveRecordScope)
65
+ end
@@ -9,7 +9,9 @@ module EdgeRider
9
9
  scope
10
10
  end
11
11
 
12
- ActiveRecord::Base.extend(self)
13
-
14
12
  end
15
13
  end
14
+
15
+ ActiveSupport.on_load :active_record do
16
+ extend(EdgeRider::OriginClass)
17
+ end
@@ -20,8 +20,10 @@ module EdgeRider
20
20
  preloader.new(records: records, associations: associations, **options).call
21
21
  end
22
22
  end
23
-
24
- ActiveRecord::Base.send(:extend, self)
25
- ActiveRecord::Base.send(:include, PreloadAssociationsInstanceMethod)
26
23
  end
27
24
  end
25
+
26
+ ActiveSupport.on_load :active_record do
27
+ extend(EdgeRider::PreloadAssociations)
28
+ include(EdgeRider::PreloadAssociations::PreloadAssociationsInstanceMethod)
29
+ end
@@ -1,30 +1,32 @@
1
1
  module EdgeRider
2
2
  module Scoped
3
-
3
+
4
4
  VALID_FIND_OPTIONS = [ :conditions, :include, :joins, :limit, :offset,
5
5
  :order, :select, :readonly, :group, :having, :from, :lock ]
6
6
 
7
7
  def scoped(options = nil)
8
8
  options ||= {}
9
9
  relation = all
10
-
10
+
11
11
  options.assert_valid_keys(VALID_FIND_OPTIONS)
12
12
  finders = options.dup
13
13
  finders.delete_if { |key, value| value.nil? && key != :limit }
14
-
14
+
15
15
  ((VALID_FIND_OPTIONS - [:conditions, :include]) & finders.keys).each do |finder|
16
16
  relation = relation.send(finder, finders[finder])
17
17
  end
18
-
18
+
19
19
  relation = relation.where(finders[:conditions]) if options.has_key?(:conditions)
20
20
  relation = relation.includes(finders[:include]) if options.has_key?(:include)
21
-
21
+
22
22
  relation
23
23
  end
24
24
 
25
- if ActiveRecord::VERSION::MAJOR >= 4
26
- ActiveRecord::Base.extend(self)
27
- end
25
+ end
26
+ end
28
27
 
28
+ ActiveSupport.on_load :active_record do
29
+ if ActiveRecord::VERSION::MAJOR >= 4
30
+ extend(EdgeRider::Scoped)
29
31
  end
30
32
  end
@@ -5,8 +5,9 @@ module EdgeRider
5
5
  ids = collect_ids
6
6
  EdgeRider::Util.exclusive_query(self, id: ids)
7
7
  end
8
-
9
- ActiveRecord::Base.send(:extend, self)
10
-
11
8
  end
12
9
  end
10
+
11
+ ActiveSupport.on_load :active_record do
12
+ extend(EdgeRider::ToIdQuery)
13
+ end
@@ -16,7 +16,7 @@ module EdgeRider
16
16
  # In Rails 4, conditions on a scope are expressed as a lambda parameter
17
17
  # that is called `scope`.
18
18
  raise NotImplementedError if reflection.options[:conditions] or (reflection.respond_to?(:scope) && reflection.scope)
19
-
19
+
20
20
  if reflection.macro == :belongs_to # belongs_to
21
21
  ids = scope.collect_column(foreign_key, distinct: true)
22
22
  scope = EdgeRider::Util.exclusive_query(reflection.klass, id: ids)
@@ -40,7 +40,9 @@ module EdgeRider
40
40
 
41
41
  end
42
42
 
43
- ActiveRecord::Base.extend(self)
44
-
45
43
  end
46
44
  end
45
+
46
+ ActiveSupport.on_load :active_record do
47
+ extend(EdgeRider::TraverseAssociation)
48
+ end
@@ -1,3 +1,3 @@
1
1
  module EdgeRider
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edge_rider
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2024-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.2.3
88
+ rubygems_version: 3.2.32
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Power tools for ActiveRecord relations (scopes)