Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Typically I configure the host information for the mailer in an appropriate <code>config/environment</code> file.</p> <pre><code>config.action_mailer.default_url_options = { :host =&gt; "example.com" } </code></pre> <p>You can take a look at the "Generating URLs" section of this page: <a href="http://rails.rubyonrails.org/classes/ActionMailer/Base.html" rel="nofollow">http://rails.rubyonrails.org/classes/ActionMailer/Base.html</a></p> <p>With that configuration set typical routing structures seem to work quite nicely. I am not 100% positive what routes will be available in your situation so you may still need to construct the full URL somewhat manually to include the reset token component.</p> <p>To generate the actual URLs you can potentially use named routes if your routes are set up in a way that you have a named route that takes a user token. i.e.</p> <pre><code>&lt;%= edit_password_resets_url(@user.password_reset_token) %&gt; </code></pre> <p>If you do not have the token integrated into an existing route you may need to manually build the URL: </p> <pre><code>&lt;%= "#{url_for(:controller =&gt; 'password_resets', :action =&gt; 'whatever_action_this_is')}/#{@user.password_reset_token}/edit/" %&gt; </code></pre> <p>or even build it completely manually using <code>default_url_options[:host]</code> and then add the rest that you have above.</p> <p>If need be you could also set the host at request time although that may be overkill (and will not be thread safe).</p> <pre><code>def set_mailer_host ActionMailer::Base.default_url_options[:host] = request.host_with_port end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload