Skip to content
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

Pass a different host or _url options to mailer magic_link_url #48

Closed
SethHorsley opened this issue Dec 28, 2023 · 0 comments · Fixed by #49
Closed

Pass a different host or _url options to mailer magic_link_url #48

SethHorsley opened this issue Dec 28, 2023 · 0 comments · Fixed by #49

Comments

@SethHorsley
Copy link
Contributor

SethHorsley commented Dec 28, 2023

I have a multi-tenant site and need to keep the host / subdomain from the request and pass it into the magic_link_url in the mailer somehow.

I made a monkey patch but maybe there is a better way to handle this - #49

With this you can do:

resource&.send_magic_link(remember_me: create_params[:remember_me], opts: {host: request.host})

and in the mailer you can:

magic_link_url(@resource, @scope_name => {email: @resource.email, token: @token, remember_me: @remember_me},
  host: @opts.dig(:opts)&.dig(:host) || Rails.application.config.action_mailer.default_url_options[:host]
)
@SethHorsley SethHorsley changed the title Pass a different host or _url options Pass a different host or _url options to mailer magic_link_url Dec 28, 2023
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

Successfully merging a pull request may close this issue.

1 participant