Thanks @Leonid for this wonderful approach for handling configurations.
I faced a problem in extending this approach to an already existing project.
Scenario:
There were existing config.x nested attributes in env specific files (eg: development.rb)
Defining self.config method in application.rb disrupts the default config.x class and thus affects the behaviour in other files (because now the config.x will be an instance of Hash/with_indifferent_access)
Also after defining the self.config, we will loose existing config. values
I worked around it by adding the following method.
config_for(:app).each do |key, val|
config.send("#{key}=", val)
end
So that the existing behaviours is not disturbed.
Also I believe it's advised to use config.x only for nested attributes.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks @Leonid for this wonderful approach for handling configurations.
I faced a problem in extending this approach to an already existing project.
Scenario:
config.x
nested attributes in env specific files (eg: development.rb)self.config
method in application.rb disrupts the default config.x class and thus affects the behaviour in other files (because now the config.x will be an instance ofHash/with_indifferent_access
)self.config
, we will loose existing config. valuesI worked around it by adding the following method.
So that the existing behaviours is not disturbed.
Also I believe it's advised to use
config.x
only for nested attributes.