Hi
In my application I have a mail sending part in which a user get mail
with a link to activate his account. What I am currently doing is as a
part of test I created a staging environment And in
config/environments/staging.rb I write like
config.action_mailer.default_url_options = { :host =>
"Ip_address_here"
}
It is working fine And the user get a mail with content say to
click http://192.168.0.12/activate/token
Now a problem I find is suppose if have to test the same
application in another server in another location I have to edit the
above to match the IP address of that machine And one more problem is
if it is hosted in a public IP a user belong to that network get a mail
like say Click
http://72.x.x.x/actiavate/token to activate. But it may not work from
that network. So agin I have to edit and change it
My question: Is this the standard way ?.Please advise me the correct
approach to do this. Or Can I use ActionController::Request class for
this
Thanks in advance
Tom
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Dieter Lunn
2010-Mar-10 05:49 UTC
Re: config.action_mailer.default_url_options = { :host => }
Use a url. :host => "localhost:3000" or :host => "mywebsite.com" Dieter Lunn http://www.coder2000.ca On Tue, Mar 9, 2010 at 11:44 PM, Tom Mac <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi > In my application I have a mail sending part in which a user get mail > with a link to activate his account. What I am currently doing is as a > part of test I created a staging environment And in > config/environments/staging.rb I write like > config.action_mailer.default_url_options = { :host => "Ip_address_here" > } > > It is working fine And the user get a mail with content say to > click http://192.168.0.12/activate/token > > Now a problem I find is suppose if have to test the same > application in another server in another location I have to edit the > above to match the IP address of that machine And one more problem is > if it is hosted in a public IP a user belong to that network get a mail > like say Click > http://72.x.x.x/actiavate/token to activate. But it may not work from > that network. So agin I have to edit and change it > My question: Is this the standard way ?.Please advise me the correct > approach to do this. Or Can I use ActionController::Request class for > this > > > Thanks in advance > Tom > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Dieter
Your answer, if I undersood correctly is to specify like
config.action_mailer.default_url_options = { :host =>
"localhost:3000" }
in enviroment. This is what I do now. But my question is how to
make it dynamic. Means some thing like
config.action_mailer.default_url_options = { :host =>
request.host_with_port() }
And also only at a single place to make it DRY
Tom
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.