Hey all, I hope it’s not a problem that I’m jumping in here after May but I thought of a topic in Rails that I suspect causes people a lot of difficulties when customizing and extending: initialization
There’s a number of layers of initialization as far as I can tell:
- Everything that runs inside an Application, Engine or Railtie
- The contents of the
initializerblocks inside an Application, Engine or Railtie.
- The methods in
- The intializers in
Understanding how all of those fit together is quite complex because there’s almost no documentation or guidance on their use so I’m left with a lot of questions.
- What is the actual order of loading when taking all of these layers into account?
- If I need something available for a rake task, where does it need to go?
- What about ordering parts of the initialization process so I don’t need to worry about the order gems are in my Gemfile?
- What parts of my application, like models, are loaded and available at a given point in the initialization process?
Some sort of guide on how to use the layers, how they work together and where various types of initialization should go, i.e. If you want to add
x, you should put it in this part of the process, would really make extending Rails properly far easier and enjoyable.