Skip to content

Use ActiveStorage::SetCurrent to simplify Admin:ProjectsController #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
floehopper opened this issue May 13, 2025 · 0 comments
Open

Comments

@floehopper
Copy link
Contributor

I noticed that there's a before action in Admin::ProjectsController that sets ActiveStorage::Current.url_options:

def set_host_for_local_storage
return unless Rails.application.config.active_storage.service == :local
ActiveStorage::Current.url_options = { host: request.base_url }
end

I think we might be able to include ActiveStorage::SetCurrent into the controller instead:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant