What is the purpose of the initializer Turbines


#1

Hi,

I was wondering what is the benefit of the after_initalizer and initalizer Turbine over just placing my initializer in config/initializer? Is it just the recommended way for third party libraries (like the Jets Sentry gem)?

Thanks


#2

Yes. Initializers are a way for 3rd parties to hook into the Jets boot process and extend it.

  • initalizer - runs pretty early on before
  • after_initalizer - runs after your the app has been initialized so you’ll have access to more things IE: Jets.application.config

You probably have seen the docs:

https://rubyonjets.com/docs/jets-turbines/

Posting for posterity for others also though.


#3

Thanks! So for my apps it’s still the recommended way to use the initializer directory instead of a Turbine, right? Maybe we should clarify this in the docs a little bit then?


#4

Ah I see. Cool. So using regular app initializers vs Turbine initializers.

Yup, think generally you want to use a regular app initializer. The Turbines are really for reusable plugins and gems. Can add a sentence or so to help clarify it.