From 229693ec61ee08965467c4df12b71149855d51eb Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 10 May 2017 18:15:08 +0200 Subject: [PATCH] Fix root_url method unavailable in application_helper [SCI-1252] --- app/helpers/application_helper.rb | 3 ++- config/environments/development.rb | 4 ++++ config/environments/production.rb | 4 ++++ config/environments/test.rb | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cf037686a..271927bdf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -226,6 +226,7 @@ module ApplicationHelper unless user.avatar(style) == '/images/icon_small/missing.png' return user.avatar(style) end - URI.join(root_url, "/images/#{style}/missing.png").to_s + URI.join(Rails.application.routes.url_helpers.root_url, + "/images/#{style}/missing.png").to_s end end diff --git a/config/environments/development.rb b/config/environments/development.rb index ddcca9b21..c70b368d0 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,6 +13,10 @@ Rails.application.configure do config.consider_all_requests_local = true config.action_controller.perform_caching = false + Rails.application.routes.default_url_options = { + host: Rails.application.secrets.mail_server_url + } + # Don't care if the mailer can't send. config.action_mailer.default_url_options = { host: Rails.application.secrets.mail_server_url diff --git a/config/environments/production.rb b/config/environments/production.rb index 197f1a42c..4778a5637 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,6 +14,10 @@ Rails.application.configure do config.consider_all_requests_local = false config.action_controller.perform_caching = true + Rails.application.routes.default_url_options = { + host: Rails.application.secrets.mail_server_url + } + # Don't care if the mailer can't send. config.action_mailer.default_url_options = { host: Rails.application.secrets.mail_server_url diff --git a/config/environments/test.rb b/config/environments/test.rb index f917df2bd..3196c32ef 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,6 +36,10 @@ Rails.application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + Rails.application.routes.default_url_options = { + host: Rails.application.secrets.mail_server_url + } + # Don't care if the mailer can't send. config.action_mailer.default_url_options = { host: Rails.application.secrets.mail_server_url } config.action_mailer.default_options = { from: Rails.application.secrets.mail_from }