Hi everyone,
I need to build a url in my mails view. For restfull resources I can use
routing and "..._url" target. But for custom url I don''t
know how I
get the hostname of my web app.
I didn''t know how I can get get the value specified on
config.action_mailer.default_url_options = {:host =>
"here_my_host_i_want_get" }
Thanks for reply
Vincent
--
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.
I believe you can access it through ActionMailer::Base.default_url_options[:host] Or alternately, you can just generate the URL using url_for() -- 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.
On Mon, Jan 17, 2011 at 7:34 AM, Vincent Romagnoli <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Hi everyone, > > I need to build a url in my mails view. For restfull resources I can use > routing and "..._url" target. But for custom url I don''t know how I > get the hostname of my web app. > > I didn''t know how I can get get the value specified on > config.action_mailer.default_url_options = {:host => > "here_my_host_i_want_get" } >What I would do is pass it in on your mailer method... you can get the host name in your controller: request.host. I see action mailer as a model essentially so you should not couple it to the session.> > Thanks for reply > > Vincent > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tim Shaffer wrote in post #975474:> I believe you can access it through > ActionMailer::Base.default_url_options[:host] > > Or alternately, you can just generate the URL using url_for()Yes ActionMailer::Base.default_url_options[:host] work fine. Thanks for your help. vincent -- 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.
Seemingly Similar Threads
- Unable to set default_url_options[:host] for Action Mailer
- Cannot receive from specified address Unauthenticated senders not allowed
- Problems with *_path() and *_url() helpers when using Publisher
- ActionMailer and url_for in helper methods
- can''t find view from Mailer?