named route's URL in Rails
HI,
I have a problem printing the named route's URL in production application. In one of my email template (email registration confirmation), am trying to append the confirmation ur开发者_StackOverflow中文版l. this is the template snippet
<p>Welcome to example. To complete your registration, please click on the link below or paste it into a browser to confirm your e-mail address. You will then be redirected to example.com login page </p>
<p> <%= confirmlogin_url(:id => @user.id, :msg => @user.verification_code )%> </p>
and my named route looks like this
match 'confirm_registration' => 'users#confirm_user' ,:as=> :confirmlogin
It works fine in the development environment, and the email is rendered with the confirmation url like this
Welcome to example. To complete your
registration, please click on the link
below or paste it into a browser to
confirm your e-mail address. You will
then be redirected to example.com.
http://localhost:3000/confirm_registration?id=16&msg=7fe548db-ab7d-3a8d-a87f-94ba89b0c29b
But in production environment i expected localhost:3000 be replaced with my actual domain name. But it still prints the local host url..
I just wanted to confirm this is the expected behavior..?
Put this onto your production.rb
ActionMailer::Base.default_url_options[:host] = "0.0.0.0:3000"
Use your hostname.
精彩评论