Search code examples
ruby-on-railsruby-on-rails-3herokudevisedevise-confirmable

how to change mail link in devise from localhost to herokuapp?


I have rails app and i have hosted in heroku. when the user is created devise sends a confirmation to the mail where clicking on the link will cofirm the user account. The problem is the link in the mail points to localhost instead of herokuapp.com, so how can i change the link from localhost to herokuapp.com. Please help me

the link in the mail points to

http://localhost:3000/signup/confirmation?confirmation_token=sdgfshtdf364wygd

but i want the link to point to

http://example.herokuapp.com/signup/confirmation?confirmation_token=sdgfshtdf364wygd 

Solution

  • Within config/environments go to production.rb, at the bottom put

     config.action_mailer.default_url_options = { :host => 'http://nameofyourherokuapp.herokuapp.com' }
    

    ensure you have your smtp settings in there also as you would in your development environment