문제

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 
도움이 되었습니까?

해결책

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

다른 팁

In application.rb set

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

Or make it per environment in environment dir

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top