rails: config_for raises an error for arrays when there's only a shared key
Steps to reproduce
I’m using a config files to blacklist some jwt tokens like this:
# config/jwt_blacklist.yml
---
shared:
- token1
- token2
In application.rb
config.jwt_whitelist = config_for(:jwt_whitelist)
Expected behavior
Rails.configuration.jwt_whitelist
=> ["token1", "token2"]
Actual behavior
railties-6.1.4/lib/rails/application.rb:252:in `config_for': undefined method `deep_merge' for ["token1", "token2"]:Array (NoMethodError)
It worked on rails 6.1.3.2, I think it has been introduced with https://github.com/rails/rails/commit/3fe0ab52dff018ed940ad45885c9d90208eb3cac (related issue: https://github.com/rails/rails/issues/42037 )
Thanks to this issue I think it should accepts arrays.
Moreover, I tried the following:
production: []
test: []
development: []
shared:
- token1
- token2
And it returns an empty array:
Rails.configuration.jwt_whitelist
=> []
Not sure if it’s a normal behaviour too.
System configuration
Rails version: 6.1.4
Ruby version: 2.7.2p137
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- config_for accepts root shared as an array Fix a bug introduced by https://github.com/rails/rails/commit/3fe0ab52dff018ed940ad45885c9d90208eb3cac that raised an undefined method when trying to deep m... — committed to skelz0r/rails by skelz0r 3 years ago
- config_for accepts root shared as an array Fix a bug introduced by https://github.com/rails/rails/commit/3fe0ab52dff018ed940ad45885c9d90208eb3cac that raised an undefined method when trying to deep m... — committed to MatheusRich/rails by skelz0r 3 years ago
6.1 is supposed to only receive security fixes: https://guides.rubyonrails.org/maintenance_policy.html
@intrip Yes I can do that!