Reputation: 368
I'm trying to add TrueMail (https://github.com/rubygarage/truemail) to my Rails Application and in order for it work I need to configure it. However, I'm not sure where to create a file to add the configuration.
If you click on the link (https://github.com/rubygarage/truemail) and view the code just under "Setting global configuration" you'll see what I'm talking about. However, I have no idea where this needs to go.
Any assistance would be greatly appreciated.
Upvotes: 1
Views: 889
Reputation: 1
Corey! It's pretty easy. For start using Truemail in your Rails application just follow next steps:
gem 'truemail'
line into your Gemfilebundle install
./config/initializers/truemail.rb
and add valid config follow with truemail documentation. Please note, you needn't add line with require 'truemail'
, Rails loader will do it for you.Cheers!
Upvotes: 0
Reputation: 10546
Place it in config/initializers/truemail.rb
. You can learn more about initializers at https://guides.rubyonrails.org/v2.3/configuring.html#using-initializers:
After it loads the framework plus any gems and plugins in your application, Rails turns to loading initializers. An initializer is any file of ruby code stored under
/config/initializers
in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks and plugins are loaded.
This is where almost every gem configuration is placed, and the naming convention is typically config/initializers/gem-name.rb
, e.g., if you were using a gem called superlogger
that required configuration you would place it in config/initializers/superlogger.rb
.
Note that since you're using Rails you likely do not need the following line:
require 'truemail'
Upvotes: 3