Can anyone explain the intended usage within “environment.rb” of the areas (a) within the "Rails::Initializer.run do |config| " block section and (b) the area after this block.
For example when/what do I include in the "Rails::
Initializer.run do |config| " section versus not? As an example say setting up constants.
Can anyone explain the intended usage within "environment.rb" of the
areas (a) within the "Rails::Initializer.run do |config| " block
section and (b) the area after this block.
For example when/what do I include in the "Rails:: Initializer.run do
>config> " section versus not? As an example say setting up constants.
It still didn’t fully clarify things for me however. I see they state: “With the exceptions of the RAILS_GEM_VERSION constant and the setting for what environment to use, the bulk of the configuration in Rails happens within the Rails::
Initializer.run block.”
However I note that in my application I am currently (writely or wrongly) been setting various parameters outside the "Rails::Initializer.run
do |config| " block…, e.g.
class Logger
def format_message(severity, timestamp, progname, msg) etc
So it’s still not quite clear to me whether I’m currently following rails best practice or not? Any advice anyone?
I set up all my constants, including ActionMailer settings, after the
Rails::Initializer.run block, and I believe this is the correct way to
do it. Apart from anything else, I don't think they don't require access
to the config object which is passed to the block.