active_record-associated_object 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +105 -61
- data/README.md +2 -0
- data/Rakefile +0 -9
- data/active_record-associated_object.gemspec +1 -2
- data/lib/active_record/associated_object/railtie.rb +2 -2
- data/lib/active_record/associated_object/version.rb +1 -1
- data/lib/active_record/associated_object.rb +1 -1
- metadata +19 -5
- data/lib/active_record/associated_object/performs.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c4701ccba7500ef91ffd5d4c6978c9cef567bb8150a5e8724e6654f22688020
|
4
|
+
data.tar.gz: 8848a32bb16888dfda3a77f11c14c01e14d59532a19aa3a063b38bea7042fd18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6756cbb26cacb5279fa40ddda01f82d9e9a61956f4dafcfa45a8a0c61afa8b62df9a1b2ec86b31a995aef058a1c0989c14fb304680310e8c09e78fab95be7e31
|
7
|
+
data.tar.gz: 78f334424f4df172b084c1fb1c3f42094804a99bec24e5870dd53e95727b28c54f7ad5e36af196f71270ff86dc303f26fe530572b3f5f209865b8d92d9ceb0d1
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.2.2
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,92 +1,135 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_record-associated_object (0.
|
4
|
+
active_record-associated_object (0.4.1)
|
5
|
+
active_job-performs
|
5
6
|
activerecord (>= 6.1)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
actionpack (7.
|
11
|
-
actionview (= 7.
|
12
|
-
activesupport (= 7.
|
13
|
-
|
11
|
+
actionpack (7.1.1)
|
12
|
+
actionview (= 7.1.1)
|
13
|
+
activesupport (= 7.1.1)
|
14
|
+
nokogiri (>= 1.8.5)
|
15
|
+
rack (>= 2.2.4)
|
16
|
+
rack-session (>= 1.0.1)
|
14
17
|
rack-test (>= 0.6.3)
|
15
|
-
rails-dom-testing (~> 2.
|
16
|
-
rails-html-sanitizer (~> 1.
|
17
|
-
actionview (7.
|
18
|
-
activesupport (= 7.
|
18
|
+
rails-dom-testing (~> 2.2)
|
19
|
+
rails-html-sanitizer (~> 1.6)
|
20
|
+
actionview (7.1.1)
|
21
|
+
activesupport (= 7.1.1)
|
19
22
|
builder (~> 3.1)
|
20
|
-
erubi (~> 1.
|
21
|
-
rails-dom-testing (~> 2.
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
|
24
|
-
|
23
|
+
erubi (~> 1.11)
|
24
|
+
rails-dom-testing (~> 2.2)
|
25
|
+
rails-html-sanitizer (~> 1.6)
|
26
|
+
active_job-performs (0.2.0)
|
27
|
+
activejob (>= 6.1)
|
28
|
+
activejob (7.1.1)
|
29
|
+
activesupport (= 7.1.1)
|
25
30
|
globalid (>= 0.3.6)
|
26
|
-
activemodel (7.
|
27
|
-
activesupport (= 7.
|
28
|
-
activerecord (7.
|
29
|
-
activemodel (= 7.
|
30
|
-
activesupport (= 7.
|
31
|
-
|
31
|
+
activemodel (7.1.1)
|
32
|
+
activesupport (= 7.1.1)
|
33
|
+
activerecord (7.1.1)
|
34
|
+
activemodel (= 7.1.1)
|
35
|
+
activesupport (= 7.1.1)
|
36
|
+
timeout (>= 0.4.0)
|
37
|
+
activesupport (7.1.1)
|
38
|
+
base64
|
39
|
+
bigdecimal
|
32
40
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
41
|
+
connection_pool (>= 2.2.5)
|
42
|
+
drb
|
33
43
|
i18n (>= 1.6, < 2)
|
34
44
|
minitest (>= 5.1)
|
45
|
+
mutex_m
|
35
46
|
tzinfo (~> 2.0)
|
47
|
+
base64 (0.1.1)
|
48
|
+
bigdecimal (3.1.4)
|
36
49
|
builder (3.2.4)
|
37
|
-
concurrent-ruby (1.
|
50
|
+
concurrent-ruby (1.2.2)
|
51
|
+
connection_pool (2.4.1)
|
38
52
|
crass (1.0.6)
|
39
|
-
debug (1.
|
40
|
-
irb (>= 1.
|
41
|
-
reline (>= 0.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
53
|
+
debug (1.8.0)
|
54
|
+
irb (>= 1.5.0)
|
55
|
+
reline (>= 0.3.1)
|
56
|
+
drb (2.1.1)
|
57
|
+
ruby2_keywords
|
58
|
+
erubi (1.12.0)
|
59
|
+
globalid (1.2.1)
|
60
|
+
activesupport (>= 6.1)
|
61
|
+
i18n (1.14.1)
|
46
62
|
concurrent-ruby (~> 1.0)
|
47
|
-
io-console (0.
|
48
|
-
irb (1.
|
49
|
-
|
50
|
-
|
63
|
+
io-console (0.6.0)
|
64
|
+
irb (1.8.3)
|
65
|
+
rdoc
|
66
|
+
reline (>= 0.3.8)
|
67
|
+
kredis (1.6.0)
|
68
|
+
activemodel (>= 6.0.0)
|
51
69
|
activesupport (>= 6.0.0)
|
52
|
-
redis (
|
53
|
-
loofah (2.
|
70
|
+
redis (>= 4.2, < 6)
|
71
|
+
loofah (2.21.4)
|
54
72
|
crass (~> 1.0.2)
|
55
|
-
nokogiri (>= 1.
|
56
|
-
|
57
|
-
minitest (
|
58
|
-
|
73
|
+
nokogiri (>= 1.12.0)
|
74
|
+
minitest (5.20.0)
|
75
|
+
minitest-sprint (1.2.2)
|
76
|
+
path_expander (~> 1.1)
|
77
|
+
mutex_m (0.1.2)
|
78
|
+
nokogiri (1.15.4-arm64-darwin)
|
59
79
|
racc (~> 1.4)
|
60
|
-
nokogiri (1.
|
80
|
+
nokogiri (1.15.4-x86_64-linux)
|
61
81
|
racc (~> 1.4)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
82
|
+
path_expander (1.1.1)
|
83
|
+
psych (5.1.1.1)
|
84
|
+
stringio
|
85
|
+
racc (1.7.1)
|
86
|
+
rack (3.0.8)
|
87
|
+
rack-session (2.0.0)
|
88
|
+
rack (>= 3.0.0)
|
89
|
+
rack-test (2.1.0)
|
90
|
+
rack (>= 1.3)
|
91
|
+
rackup (2.1.0)
|
92
|
+
rack (>= 3)
|
93
|
+
webrick (~> 1.8)
|
94
|
+
rails-dom-testing (2.2.0)
|
95
|
+
activesupport (>= 5.0.0)
|
96
|
+
minitest
|
68
97
|
nokogiri (>= 1.6)
|
69
|
-
rails-html-sanitizer (1.
|
70
|
-
loofah (~> 2.
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
98
|
+
rails-html-sanitizer (1.6.0)
|
99
|
+
loofah (~> 2.21)
|
100
|
+
nokogiri (~> 1.14)
|
101
|
+
railties (7.1.1)
|
102
|
+
actionpack (= 7.1.1)
|
103
|
+
activesupport (= 7.1.1)
|
104
|
+
irb
|
105
|
+
rackup (>= 1.0.0)
|
75
106
|
rake (>= 12.2)
|
76
|
-
thor (~> 1.0)
|
77
|
-
zeitwerk (~> 2.
|
78
|
-
rake (13.0
|
79
|
-
|
80
|
-
|
107
|
+
thor (~> 1.0, >= 1.2.2)
|
108
|
+
zeitwerk (~> 2.6)
|
109
|
+
rake (13.1.0)
|
110
|
+
rdoc (6.5.0)
|
111
|
+
psych (>= 4.0.0)
|
112
|
+
redis (5.0.8)
|
113
|
+
redis-client (>= 0.17.0)
|
114
|
+
redis-client (0.18.0)
|
115
|
+
connection_pool
|
116
|
+
reline (0.3.9)
|
81
117
|
io-console (~> 0.5)
|
82
|
-
|
83
|
-
|
84
|
-
|
118
|
+
ruby2_keywords (0.0.5)
|
119
|
+
sqlite3 (1.6.7-arm64-darwin)
|
120
|
+
sqlite3 (1.6.7-x86_64-linux)
|
121
|
+
stringio (3.0.8)
|
122
|
+
thor (1.3.0)
|
123
|
+
timeout (0.4.0)
|
124
|
+
tzinfo (2.0.6)
|
85
125
|
concurrent-ruby (~> 1.0)
|
86
|
-
|
126
|
+
webrick (1.8.1)
|
127
|
+
zeitwerk (2.6.12)
|
87
128
|
|
88
129
|
PLATFORMS
|
89
130
|
arm64-darwin-20
|
131
|
+
arm64-darwin-21
|
132
|
+
arm64-darwin-22
|
90
133
|
x86_64-linux
|
91
134
|
|
92
135
|
DEPENDENCIES
|
@@ -95,9 +138,10 @@ DEPENDENCIES
|
|
95
138
|
debug
|
96
139
|
kredis
|
97
140
|
minitest (~> 5.0)
|
141
|
+
minitest-sprint (~> 1.2)
|
98
142
|
railties
|
99
143
|
rake (~> 13.0)
|
100
144
|
sqlite3
|
101
145
|
|
102
146
|
BUNDLED WITH
|
103
|
-
2.
|
147
|
+
2.4.21
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -24,12 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
25
|
end
|
26
26
|
end
|
27
|
-
spec.bindir = "exe"
|
28
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
27
|
spec.require_paths = ["lib"]
|
30
28
|
|
31
29
|
# Uncomment to register a new dependency of your gem
|
32
30
|
spec.add_dependency "activerecord", ">= 6.1"
|
31
|
+
spec.add_dependency "active_job-performs"
|
33
32
|
|
34
33
|
# For more information and examples about making a new gem, check out our
|
35
34
|
# guide at: https://bundler.io/guides/creating_gem.html
|
@@ -4,8 +4,8 @@ class ActiveRecord::AssociatedObject::Railtie < Rails::Railtie
|
|
4
4
|
ActiveRecord::AssociatedObject.include GlobalID::Identification if defined?(GlobalID)
|
5
5
|
|
6
6
|
ActiveSupport.on_load :active_job do
|
7
|
-
require "
|
8
|
-
ActiveRecord::AssociatedObject.extend
|
7
|
+
require "active_job/performs"
|
8
|
+
ActiveRecord::AssociatedObject.extend ActiveJob::Performs
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -16,7 +16,7 @@ class ActiveRecord::AssociatedObject
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def respond_to_missing?(...) = record_klass.respond_to?(...) || super
|
19
|
-
delegate :unscoped, :transaction, to: :record_klass
|
19
|
+
delegate :unscoped, :transaction, :primary_key, to: :record_klass
|
20
20
|
|
21
21
|
def method_missing(method, ...)
|
22
22
|
if !record_klass.respond_to?(method) then super else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record-associated_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Timm Hansen
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: active_job-performs
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
- hey@kaspth.com
|
@@ -31,6 +45,7 @@ executables: []
|
|
31
45
|
extensions: []
|
32
46
|
extra_rdoc_files: []
|
33
47
|
files:
|
48
|
+
- ".tool-versions"
|
34
49
|
- CHANGELOG.md
|
35
50
|
- Gemfile
|
36
51
|
- Gemfile.lock
|
@@ -40,7 +55,6 @@ files:
|
|
40
55
|
- active_record-associated_object.gemspec
|
41
56
|
- lib/active_record/associated_object.rb
|
42
57
|
- lib/active_record/associated_object/object_association.rb
|
43
|
-
- lib/active_record/associated_object/performs.rb
|
44
58
|
- lib/active_record/associated_object/railtie.rb
|
45
59
|
- lib/active_record/associated_object/version.rb
|
46
60
|
homepage: https://github.com/kaspth/active_record-associated_object
|
@@ -65,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
79
|
- !ruby/object:Gem::Version
|
66
80
|
version: '0'
|
67
81
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
82
|
+
rubygems_version: 3.4.19
|
69
83
|
signing_key:
|
70
84
|
specification_version: 4
|
71
85
|
summary: Associate a Ruby PORO with an Active Record class and have it quack like
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module ActiveRecord::AssociatedObject::Performs
|
2
|
-
def performs(method = nil, **configs, &block)
|
3
|
-
@job ||= safe_define("Job") { ApplicationJob }
|
4
|
-
|
5
|
-
if method.nil?
|
6
|
-
apply_performs_to(@job, **configs, &block)
|
7
|
-
else
|
8
|
-
job = safe_define("#{method}_job".classify) { @job }
|
9
|
-
apply_performs_to(job, **configs, &block)
|
10
|
-
|
11
|
-
job.class_eval <<~RUBY, __FILE__, __LINE__ + 1 unless job.instance_method(:perform).owner == job
|
12
|
-
def perform(object, *arguments, **options)
|
13
|
-
object.#{method}(*arguments, **options)
|
14
|
-
end
|
15
|
-
RUBY
|
16
|
-
|
17
|
-
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
18
|
-
def #{method}_later(*arguments, **options)
|
19
|
-
#{job}.perform_later(self, *arguments, **options)
|
20
|
-
end
|
21
|
-
RUBY
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
def safe_define(name)
|
27
|
-
name.safe_constantize || const_set(name, Class.new(yield))
|
28
|
-
end
|
29
|
-
|
30
|
-
def apply_performs_to(job_class, **configs, &block)
|
31
|
-
job_class.class_eval do
|
32
|
-
configs.each { public_send(_1, _2) }
|
33
|
-
yield if block_given?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|