質問

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