-
Notifications
You must be signed in to change notification settings - Fork 211
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
Support for subdomain in mailer generated urls #778
Comments
Thanks. I'll try this out once I got home from vacation and will report back. Happy holidays! |
Did this ever get resolved? |
The mailer uses standard Rails stuff to generate URLs, so I'd imagine the original poster didn't have the right configuration |
Thanks for your quick response. I agree that it should be fixed, but I'm running into this myself with a similar setup. This rails issue appears to never have been fixed but it explains it way better than I could. rails/rails#34252 The fix that I'm thinking I can hack together is set the threaded mailers to inherit from my own The other option would be to change all mailer url_generation steps to make a custom Thoughts @glebm? |
the first solution I came up with worked and was fairly straightforward. # in config/initializers/thredded.rb
Thredded.parent_mailer = "ThreddedMailer"
# in app/mailers/thredded_mailer.rb
class ThreddedMailer < ActionMailer::Base
around_action :configure_default_url_options
def configure_default_url_options
original_default_url_options = self.default_url_options.dup # assumes we already have a host set
self.default_url_options[:host] = ["discussion.", self.default_url_options[:host]].join
yield
self.default_url_options = original_default_url_options
end
end |
I use thredded for my app and mounted thredded as:
Works fine exept the urls in mails points to main host and results to 404 error
Temporary work around is to create routes that redirect those requests manually to
subdoman: "forum"
The text was updated successfully, but these errors were encountered: