I\'m working with an initializer that does some monkey patching on app start by including some app concerns into a third party lib. Basically:
# config/initi
As described by @Glyoko's answer, using require
on dependencies prevents autoloading in initializers. However, doing so leads to problems during reloading as @Puhlze mentioned in his comment.
I stumbled across an alternate approach that utilizes Rails.configuration.to_prepare
in this post.
An example would be:
# config/initializers/my_initializer.rb
Rails.configuration.to_prepare do
class SomeExternalLib
include MyConcern1
include MyConcern2
end
end
Note that this runs before every request in development but only once before eager loading in production.
Edit: it appears to also work with reloading.