I’m trying to use a file that is supposed to be reloaded in development all the time and loaded in production once.
I’m trying to use
config.to_prepare do
require File.expand_path('config/configatron.rb')
end
This allows for reloading of my configatron settings in dev. However it’s not working. meaning it’s only loaded once, not being reloaded on page refreshes. According to documentation it should. Right now I have it in my application.rb – is that the right place ? If yes does anyone what am I doing wrong?
Thank you
I place my to_prepare blocks in initializers.
There is a problem with your code.
From require documentation: http://ruby-doc.org/core-1.9.3/Kernel.html#method-i-require
Even when your block is called before each environment reload require won’t load your configuration.rb file again.
Instead of using to_prepare you can try to rewrite your code using require_dependency How are require, require_dependency and constants reloading related in Rails?