Skip to content

Commit 1c09aea

Browse files
committed
PC-124: Fix setting current URL for ActiveStorage
1 parent 25b2591 commit 1c09aea

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
class ApplicationController < ActionController::Base
22
allow_browser versions: :modern
3+
34
before_action :authenticate_user!, unless: :active_admin_controller?
4-
before_action :set_current_url
5+
before_action :set_active_storage_url_options
56

67
private
78

89
def active_admin_controller?
910
is_a?(ActiveAdmin::BaseController)
1011
end
1112

12-
def set_current_url
13-
ActiveStorage::Current.url_options = { host: request.host_with_port }
13+
def set_active_storage_url_options
14+
ActiveStorage::Current.url_options = { protocol: request.protocol, host: request.host, port: request.port }
1415
end
1516
end

spec/helpers/api/v1/settings_helper_spec.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
require 'rails_helper'
22

3-
# Specs in this file have access to a helper object that includes
4-
# the Api::V1::SettingsHelper. For example:
5-
#
6-
# describe Api::V1::SettingsHelper do
7-
# describe "string concat" do
8-
# it "concats two strings with spaces" do
9-
# expect(helper.concat_strings("this","that")).to eq("this that")
10-
# end
11-
# end
12-
# end
133
RSpec.describe Api::V1::SettingsHelper, type: :helper do
144
let(:setting) { Setting.current }
155

0 commit comments

Comments
 (0)