Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of using url_helpers in resolvers
A problem I’ve been struggling with is generating URLs within the resolvers using the current host and port. A common solution is to set `Rails.application.routes.default_url_options`, but this is static and with my current setup I need to be able to return the host actually used within the request (My development environment runs over both http and https, so I can’t just hardcode localhost:3000). A solution I’ve found is to pass the controller’s request into the context, and use the `ActionController::UrlFor` concern. And likewise for Active Storage, `ActiveStorage::SetCurrent` works similarly. I thought it might be useful to share this with anyone else running into this use case.
- Loading branch information