Files
openfoodnetwork/config/initializers/action_mailer.rb
Pau Perez 2e2c7c56cb Move default_url_options set up to an initializer
For some reason running `bundle exec rake db:migrate RAILS_ENV=staging`
fails with:

```
rake aborted!
NameError: uninitialized constant Spree::Config
```

Running `bundle exec rails server` for instance, does not. There must be
a difference on the way a rake task and the rails commands load the app.

Moving this configuration to an initializer, at the end of the
initialization process, fixes it. The constant `Spree::Config` is
already loaded.

**This is preventing the release v1.22.0 from being staged and tested**
2018-10-30 19:45:04 +01:00

7 lines
233 B
Ruby

ActionMailer::Base.configure do |config|
if Rails.env.production? || Rails.env.staging?
# Use https when creating links in emails
config.default_url_options = { protocol: 'https', host: Spree::Config[:site_url] }
end
end