@@ -13,7 +13,7 @@ class Post < ApplicationRecord
1313end
1414```
1515
16- Then we build a job for the instance method and define a ` post.publish_later ` instance method, and more :
16+ Here's what ` performs ` generates under the hood :
1717
1818``` ruby
1919class Post < ApplicationRecord
@@ -25,12 +25,12 @@ class Post < ApplicationRecord
2525 def perform (post , * , ** ) = post.publish(* , ** )
2626 end
2727
28- # On Rails 7.1, where `ActiveJob.perform_all_later` exists, we also generate
28+ # On Rails 7.1+ , where `ActiveJob.perform_all_later` exists, we also generate
2929 # a bulk method to enqueue many jobs at once. So you can do this:
3030 #
3131 # Post.unpublished.in_batches.each(&:publish_later_bulk)
32- def self .publish_later_bulk
33- ActiveJob .perform_all_later all .map { PublishJob .new (_1 ) }
32+ def self .publish_later_bulk( set = all)
33+ ActiveJob .perform_all_later set .map { PublishJob .new (_1 ) }
3434 end
3535
3636 # We generate `publish_later` to wrap the job execution forwarding arguments and options.
@@ -127,8 +127,8 @@ class Post < ActiveRecord::Base
127127 # Or pass in a subset of posts as an argument:
128128 #
129129 # Post.publish_later_bulk Post.unpublished
130- def self .publish_later_bulk
131- ActiveJob .perform_all_later all .map { PublishJob .new (_1 ) }
130+ def self .publish_later_bulk( set = all)
131+ ActiveJob .perform_all_later set .map { PublishJob .new (_1 ) }
132132 end
133133
134134 # We generate `publish_later` to wrap the job execution.
0 commit comments