Jey
Jey

Reputation:

Rails initializers folder

I'm having a little trouble understanding how the files inside the intializers folder is used. Are all the files within this directory loaded automatically? Or do we need to specify which ones in some location?

The above question came into play because I wanted to setup action mailer. I created a file called smtp_gmail.rb inside this folder an defined ActionMailer::Base.smtp_settings = { ... }. Is this sufficient to let action mailer know to use these settings?

My guess is that all files in the initializers folders are loaded, and if a configuration for something specific was set, then it will be used.

Upvotes: 1

Views: 572

Answers (1)

rfunduk
rfunduk

Reputation: 30452

Yes, files in config/initializers are loaded automatically.

Here's a detailed article on the subject. See section 2.7.27.

Upvotes: 2

Related Questions