aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-02-17 00:09:23 -0500
committerGitHub <noreply@github.com>2018-02-17 00:09:23 -0500
commit21cc0432e4e996383dce88ffb89c4883a577f459 (patch)
tree0da3486b6952c046f07b59fc6802b55cd7a9dd2e /activejob
parent1f95e5b14d49390be7d0459e7479be985f499c86 (diff)
parent3cc93de6ad58ee306b906a3d979b46276900711a (diff)
downloadrails-21cc0432e4e996383dce88ffb89c4883a577f459.tar.gz
rails-21cc0432e4e996383dce88ffb89c4883a577f459.tar.bz2
rails-21cc0432e4e996383dce88ffb89c4883a577f459.zip
Merge pull request #32002 from y-yagi/fix_set_serializer
Fix custome serializer setting
Diffstat (limited to 'activejob')
-rw-r--r--activejob/lib/active_job/railtie.rb11
-rw-r--r--activejob/lib/active_job/serializers.rb2
2 files changed, 9 insertions, 4 deletions
diff --git a/activejob/lib/active_job/railtie.rb b/activejob/lib/active_job/railtie.rb
index 427ad1e3af..d0294854d3 100644
--- a/activejob/lib/active_job/railtie.rb
+++ b/activejob/lib/active_job/railtie.rb
@@ -14,8 +14,10 @@ module ActiveJob
end
initializer "active_job.custom_serializers" do |app|
- custom_serializers = app.config.active_job.delete(:custom_serializers)
- ActiveJob::Serializers.add_serializers custom_serializers
+ config.after_initialize do
+ custom_serializers = app.config.active_job.delete(:custom_serializers)
+ ActiveJob::Serializers.add_serializers custom_serializers
+ end
end
initializer "active_job.set_configs" do |app|
@@ -23,7 +25,10 @@ module ActiveJob
options.queue_adapter ||= :async
ActiveSupport.on_load(:active_job) do
- options.each { |k, v| send("#{k}=", v) }
+ options.each do |k, v|
+ k = "#{k}="
+ send(k, v) if respond_to? k
+ end
end
end
diff --git a/activejob/lib/active_job/serializers.rb b/activejob/lib/active_job/serializers.rb
index d9a130fa73..9930ae0823 100644
--- a/activejob/lib/active_job/serializers.rb
+++ b/activejob/lib/active_job/serializers.rb
@@ -49,7 +49,7 @@ module ActiveJob
# Adds a new serializer to a list of known serializers
def add_serializers(*new_serializers)
- self._additional_serializers += new_serializers
+ self._additional_serializers += new_serializers.flatten
end
end