Skip to content

Commit

Permalink
Fix/activestorage dependency details (#1480)
Browse files Browse the repository at this point in the history
Co-authored-by: Adrian <adrian@adrianthedev.com>
  • Loading branch information
MrJoy and adrianthedev committed Dec 8, 2022
1 parent f37340b commit 54efb81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions bin/init
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ app_root do

header 'Installing Yarn packages'
run! 'yarn'
run! '(cd spec/dummy; yarn)'
run! '(cp spec/dummy/.env.test.sample spec/dummy/.env.test)'

if use_docker == 'y'
header 'Creating the Docker volume'
Expand Down
10 changes: 6 additions & 4 deletions lib/avo/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def init(request:, context:, current_user:, view_context:, params:)

# Set the current host for ActiveStorage
begin
if Rails::VERSION::MAJOR === 6
ActiveStorage::Current.host = request.base_url
elsif Rails::VERSION::MAJOR === 7
ActiveStorage::Current.url_options = request.base_url
if defined?(ActiveStorage::Current)
if Rails::VERSION::MAJOR === 6
ActiveStorage::Current.host = request.base_url
elsif Rails::VERSION::MAJOR === 7
ActiveStorage::Current.url_options = request.base_url
end
end
rescue => exception
Rails.logger.debug "[Avo] Failed to set ActiveStorage::Current.url_options, #{exception.inspect}"
Expand Down
4 changes: 4 additions & 0 deletions spec/components/avo/sidebar_profile_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
Avo.configuration.sign_out_path_name = :sign_out_path_name
end

after do
Avo.configuration.sign_out_path_name = nil
end

it "renders sign out link" do
with_controller_class Avo::BaseController do
render_inline(described_class.new(user: nil))
Expand Down

0 comments on commit 54efb81

Please sign in to comment.