Thanks folks,
I haven't tried something
like config.action_mailer.default_url_options{:host => "foo.com/bar"} yet
because, while it _might_ work for my specific situation, it feels hacky
because :port is a valid option for url_for and I don't think passing in a
string with a sub directory for the :host option makes a lot of sense
because my guess is that, combined with port, you'd end up with
http://foo.com/bar:8080/sign_in, for example. Note, I haven't tried this
yet, and it might work, but I just thought I'd poll the community first in
case I was missing something super obvious.
I'll give the :host => 'foo.com/bar' default_url_options attempt a go and
see how it works, and I might even test my :port hunch even though I don't
_need_ a non-standard port right now.
-g
On Thu, Feb 17, 2011 at 4:52 PM, Stuart Coyle <[email protected]>wrote:
> From the ActionMailer documentation:
>
> "URLs can be generated in mailer views using url_for or named routes.
> Unlike controllers from Action Pack, the mailer instance doesn’t have any
> context about the incoming request, so you’ll need to provide all of the
> details needed to generate a URL."
>
> Have you tried this?
>
> config.action_mailer.default_url_options{:host => "foo.com/bar"}
>
>
> On Thu, Feb 17, 2011 at 3:32 PM, Gabe Hollombe <[email protected]> wrote:
>
>> Hey all,
>>
>> I've got a Rails 3 app. Let's say I'm deploying it to http://foo.com/bar.
>> In a mailer, I want to use sign_in_url (sign_in is a named route) to get a
>> url like http://foo.com/bar/sign_in. Alas, in the context of my mailer,
>> Rails has no idea about the fact that this app is deployed to a
>> subdirectory. So, what's the right way to get the proper url with the
>> deployed subdirectory, from the named route url helper? I thought
>> setting ENV['RAILS_RELATIVE_URL_ROOT'] = '/bar' would work, but it
>> doesn't seem to get looked at when my mailer is generating the url with the
>> named route helper.
>>
>> Any thoughts? I'm sure I'm missing something obvious here, but I clearly
>> don't know what it is.
>>
>> -g
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby or Rails Oceania" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/rails-oceania?hl=en.
>>
>
>
>
> --
> Stuart Coyle
> stuart dot coyle at gmail dot com
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.