Skip to content

Commit f4951f1

Browse files
committed
feat: default_url_options apply to entire app
1 parent 0df94af commit f4951f1

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

app/controllers/application_controller.rb

-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ class ApplicationController < ActionController::Base
77
before_action :http_auth_for_staging
88
before_action :set_paper_trail_whodunnit
99

10-
def default_url_options
11-
{ protocol: Setting.default_protocol }
12-
end
13-
1410
private
1511

1612
def http_auth_for_staging

app/controllers/devise_base_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ class DeviseBaseController < ApplicationController
33

44
layout :layout_by_resource
55

6-
force_ssl
7-
86
private
97

108
def flash_if_has_error
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
ActiveSupport::Reloader.to_prepare do
4+
ApplicationController.renderer.defaults.merge!(
5+
http_host: Setting.host,
6+
https: Setting.default_protocol.to_s.downcase == 'https'
7+
)
8+
9+
ApplicationController.default_url_options.merge!(
10+
protocol: Setting.default_protocol,
11+
host: Setting.host
12+
)
13+
14+
Rails.application.routes.default_url_options.merge!(
15+
protocol: Setting.default_protocol,
16+
host: Setting.host
17+
)
18+
end
19+

config/initializers/application_controller_renderer.rb

-8
This file was deleted.

0 commit comments

Comments
 (0)