For the same problem, I just hardwired the hostname into the individual
environments:

In production:
HOSTNAME = "obsidianportal.com"

In development:
HOSTNAME = "localhost:3000"

Yeah, maybe not the sexiest solution, but it worked and it's only one place
that has to be changed should you ever have to change hostnames.

Micah



[EMAIL PROTECTED] wrote:
> Yeah, it looks like this is problematic for two reasons:
>
>  1) I'm in an ActionMailer, not a Controller
>
>  2) the mechanism is firing because of an Observer.  I'm
>     not clear on the details of how this execution path
>     differs, but it does seem to take part in decoupling
>     me from the info I want in my outgoing email.
>
> Later when I get a chance I'll try stuffing the request
> info (host and protocol) into the session when I'm still
> in the observed action, and see if it makes it to
> my mail-sender action.  That may be wildly off-base,
> I have no idea yet, so no snickering! :-)
>
> I do have access to ENV in the ActionMailer, but the info
> from that seems to be even more variable depending on OS,
> web server, shell stuff, etc, so I don't think that's
> usable.  I'm guessing system'ing out and getting a web
> server environment would be about the same.
>
>     -glenn
>
> Chris Abad wrote:
>> If you're sending the mailer from your controller, you can pass
>> either the whole request hash, or just the host, to the delivery
>> method. If you're using an observer, I don't think that'll work.
>>
>> I think the way we do it is hardcode the host, and the subdomain is
>> pulled from the database (each account has a unique subdomain, but
>> all on the same host name).
>>
>> Once you start considering things like host name and subdomains in
>> your app, development gets to be a PITA. I've had very much the same
>> experience as the WUFOO guys w/ this:
>> http://particletree.com/notebook/subdomains-development-sucks/
>>
>> On Jun 26, 2007, at 3:24 PM, Glenn Little wrote:
>>
>> Thanks, but yeah, it doesn't know about the "request" method, so I
>> can't get at request.protocol or request.host.
>>
>> Do you all just punt at this point and hardwire it in?
>>
>> Anyone who is using restful authentication, how do you
>> set @body[:url] in <user>_notifier.rb (where "user" is
>> whatever you call your user account model)?
>>
>>     -glenn
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Sdruby mailing list
>> [email protected]
>> http://lists.sdruby.com/mailman/listinfo/sdruby
> _______________________________________________
> Sdruby mailing list
> [email protected]
> http://lists.sdruby.com/mailman/listinfo/sdruby

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to