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 +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/Gemfile.4.2.mysql2.lock +1 -1
- data/Gemfile.4.2.pg.lock +1 -1
- data/Gemfile.5.2.mysql2.lock +2 -2
- data/Gemfile.5.2.pg.lock +2 -2
- data/Gemfile.6.1.pg.lock +1 -1
- data/Gemfile.7.0.pg.lock +2 -2
- data/Gemfile.lock +1 -1
- data/lib/edge_rider/collect_column.rb +4 -2
- data/lib/edge_rider/collect_ids.rb +7 -6
- data/lib/edge_rider/origin_class.rb +4 -2
- data/lib/edge_rider/preload_associations.rb +5 -3
- data/lib/edge_rider/scoped.rb +10 -8
- data/lib/edge_rider/to_id_query.rb +4 -3
- data/lib/edge_rider/traverse_association.rb +5 -3
- data/lib/edge_rider/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32bfec9bfa5c200e32346b737cab2a2ca8022a7970592b545ea441d18fc7cb1e
|
4
|
+
data.tar.gz: 27a7901e4a45da9e8c82672b4c94157a811308a85fbef9bda063c2c8854bbf3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
1
|
+
Gemfile.6.1.pg
|
data/Gemfile.4.2.mysql2.lock
CHANGED
data/Gemfile.4.2.pg.lock
CHANGED
data/Gemfile.5.2.mysql2.lock
CHANGED
data/Gemfile.5.2.pg.lock
CHANGED
data/Gemfile.6.1.pg.lock
CHANGED
data/Gemfile.7.0.pg.lock
CHANGED
data/Gemfile.lock
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.6.1.pg.lock
|
@@ -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
|
@@ -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
|
data/lib/edge_rider/scoped.rb
CHANGED
@@ -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
|
-
|
26
|
-
|
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
|
@@ -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
|
data/lib/edge_rider/version.rb
CHANGED
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.
|
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:
|
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.
|
88
|
+
rubygems_version: 3.2.32
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Power tools for ActiveRecord relations (scopes)
|