Frage

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 
War es hilfreich?

Lösung

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

Andere Tipps

In application.rb set

config.action_mailer.default_url_options = { :host => 'urlyouwant.com' }

Or make it per environment in environment dir

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top