Last active
January 1, 2016 07:09
-
-
Save firedev/8109910 to your computer and use it in GitHub Desktop.
Make Action Mailer use request host and protocol for images and links in emails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# application_controller.rb | |
class ApplicationController < ActionController::Base | |
before_action :make_action_mailer_use_request_host_and_protocol | |
def make_action_mailer_use_request_host_and_protocol | |
ActionMailer::Base.default_url_options[:protocol] = request.protocol | |
ActionMailer::Base.default_url_options[:host] = request.host_with_port | |
ActionMailer::Base.asset_host = "#{request.protocol}#{request.host_with_port}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment