Skip to content

Commit bed209d

Browse files
committed
Fix coupon URL in notifications
1 parent 7dbe4f1 commit bed209d

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

app/services/ops/coupon/expiration/notify.rb

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ module Ops
44
module Coupon
55
module Expiration
66
class Notify
7-
include Rails.application.routes.url_helpers
8-
97
attr_reader :coupon
108

119
delegate :user, to: :coupon
@@ -30,11 +28,10 @@ def template_options
3028
"code" => coupon.code,
3129
"description" => coupon.description,
3230
"valid_until" => coupon.valid_until.present? ? I18n.l(coupon.valid_until) : "",
33-
"url" => coupon_url(
31+
"url" => Rails.application.routes.url_helpers.coupon_url(
3432
user.locale,
3533
coupon,
36-
host: Rails.application.config.action_controller.default_url_options[:host],
37-
port: Rails.application.config.action_controller.default_url_options[:port]
34+
**Rails.application.config.action_controller.default_url_options
3835
)
3936
}
4037
end

config/application.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ class Application < Rails::Application
4343
I18n.available_locales = %i[en]
4444
I18n.default_locale = :en
4545

46-
config.action_mailer.default_url_options = {host: ENV.fetch("HOST", "localhost"), port: 443}
46+
config.action_mailer.default_url_options = {
47+
host: ENV.fetch("HOST", "localhost"),
48+
port: 443,
49+
protocol: :https
50+
}
4751
config.action_controller.default_url_options = config.action_mailer.default_url_options
4852
end
4953
end

config/environments/development.rb

+1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,5 @@
7676
config.action_controller.raise_on_missing_callback_actions = true
7777

7878
config.action_controller.default_url_options[:port] = 3000
79+
config.action_controller.default_url_options[:protocol] = :http
7980
end

0 commit comments

Comments
 (0)