Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8154843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:29:17+00:00 2026-06-06T16:29:17+00:00

I’m creating a password reset functionality for my site in rails and in my

  • 0

I’m creating a password reset functionality for my site in rails and in my mailer password_reset.text.erb file I’m currently sending


http://localhost:3000/password_resets/<%=@user.password_reset_token%>/edit/

in my development environment. This will hit my controller for password reset and redirect the user to edit the password if the token matches with the saved model.

However, I’d like to configure this dynamically so when I deploy to heroku it will know to change that to mywebsite.com/password_resets/...

How would I do this?

EDIT:

def password_reset(user)
    @user = user
    mail(to: user.email, subject: "Bitelist Password Reset")
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:29:20+00:00Added an answer on June 6, 2026 at 4:29 pm

    Typically I configure the host information for the mailer in an appropriate config/environment file.

    config.action_mailer.default_url_options = { :host => "example.com" }
    

    You can take a look at the “Generating URLs” section of this page: http://rails.rubyonrails.org/classes/ActionMailer/Base.html

    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.

    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.

    <%= edit_password_resets_url(@user.password_reset_token) %>
    

    If you do not have the token integrated into an existing route you may need to manually build the URL:

    <%= "#{url_for(:controller => 'password_resets', :action => 'whatever_action_this_is')}/#{@user.password_reset_token}/edit/" %>
    

    or even build it completely manually using default_url_options[:host] and then add the rest that you have above.

    If need be you could also set the host at request time although that may be overkill (and will not be thread safe).

    def set_mailer_host
      ActionMailer::Base.default_url_options[:host] = request.host_with_port
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I want use html5's new tag to play a wav file (currently only supported
I have a reasonable size flat file database of text documents mostly saved in
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.