File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,23 @@ Jobs written with the Active Job API run on any of the supported queues thanks
41
41
to their respective adapters. Active Job comes pre-configured with an inline
42
42
runner that executes jobs right away.
43
43
44
- Jobs often need to take Active Record objects as arguments, but we can't pass
45
- fully-marshaled Ruby objects through many queueing systems. Active Job passes
44
+ Jobs often need to take Active Record objects as arguments. Active Job passes
46
45
object references as URIs (uniform resource identifiers) instead of marshaling
47
46
the object itself. The new [ Global ID] ( https://github.com/rails/globalid )
48
47
library builds URIs and looks up the objects they reference. Passing Active
49
- Record objects as job arguments "just works:" Active Job passes a reference to
50
- the object, then looks up the object from its reference.
48
+ Record objects as job arguments just works by using Global ID internally.
49
+
50
+ For example, if ` trashable ` is an AR this job runs just fine
51
+
52
+ ``` ruby
53
+ class TrashableCleanupJob < ActiveJob ::Base
54
+ def perform (trashable , depth )
55
+ trashable.cleanup(depth)
56
+ end
57
+ end
58
+ ```
59
+
60
+ with no serialization involved.
51
61
52
62
See the [ Active Job Basics] ( active_job_basics.html ) guide for more
53
63
information.
You can’t perform that action at this time.
0 commit comments