mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Allow missing Action Cable config
Since #37850, `config_for` returns `nil` instead of an empty Hash when a config file does not contain configuration for the specified environment. Thus, the return value should be converted to a Hash before calling `with_indifferent_access`. Fixes #40548.
This commit is contained in:
parent
53e97f0fa0
commit
949e4587d5
2 changed files with 9 additions and 1 deletions
|
@ -30,7 +30,7 @@ module ActionCable
|
|||
|
||||
ActiveSupport.on_load(:action_cable) do
|
||||
if (config_path = Pathname.new(app.config.paths["config/cable"].first)).exist?
|
||||
self.cable = Rails.application.config_for(config_path).with_indifferent_access
|
||||
self.cable = Rails.application.config_for(config_path).to_h.with_indifferent_access
|
||||
end
|
||||
|
||||
previous_connection_class = connection_class
|
||||
|
|
|
@ -2453,6 +2453,14 @@ module ApplicationTests
|
|||
assert_nil ActiveStorage.queues[:purge]
|
||||
end
|
||||
|
||||
test "ActionCable.server.config.cable is set when missing configuration for the current environment" do
|
||||
quietly do
|
||||
app "missing"
|
||||
end
|
||||
|
||||
assert_kind_of ActiveSupport::HashWithIndifferentAccess, ActionCable.server.config.cable
|
||||
end
|
||||
|
||||
test "ActionMailbox.logger is Rails.logger by default" do
|
||||
app "development"
|
||||
|
||||
|
|
Loading…
Reference in a new issue