ActionView:: Template:: Ошибка: Отсутствует хост для ссылки! Укажите параметр: host, установите default_url_options [: host] или установите: only_path true
My ruby on rails action mailer отлично работает в среде разработки, но в рабочей среде он сохраняет бросок:
ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
Моя конфигурация конфигурации
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:port => xxx,
:address => 'smtp.example.org',
:user_name => '[email protected]',
:password => 'xxxxxxxx',
:domain => 'xxxxxx.com',
:authentication => :plain,
}
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Мой конфигурационный файл
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:port => 587,
:address => 'smtp.example.org',
:user_name => '[email protected]',
:password => 'xxxxxx',
:domain => 'example.com',
:authentication => :plain,
}
config.action_mailer.default_url_options = { :host => 'example.com' }
Мои другие среды:
ruby 2.1.1
rails 4.0.3
sidekiq
devise
devise-async
Я пробовал:
Ни один из них не работает.
Ответы
Ответ 1
В конце я добавил следующее с правильным значением для каждого файла среды:
test.rb/development.rb/production.rb
Devise 3.2.x - 4.x.x
Rails 4.1.x && & Rails 4.2.x && & Rails 5.x.x
Благодаря maudulus
# Default Mailer Host
Rails.application.routes.default_url_options[:host] = 'domain.com'
Ответ 2
Попробуйте перезагрузить сервер. Даже в Rails 4.1 конфигурация не репарационируется без перезагрузки.