Does anybody know how to access the domain of a cookie from inside rails? I am try to integrate phpbb forums into my site and one of the things phpbb does is store a cookie. The forums are at forums.domain.com and the site is www.domain.com so i needed to set the cookie domain in phpbb to just be ".domain.com" so both sites can access it. The trouble is when using cookies[] in rails, it defaults to www.domain.com. How do I tell cookies[] that i want domain ".domain.com" instead ? thanks adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060309/0193fd9a/attachment.html
Adam Denenberg wrote:> Does anybody know how to access the domain of a cookie from inside > rails? > > I am try to integrate phpbb forums into my site and one of the things > phpbb > does is store a cookie. The forums are at forums.domain.com and the > site is > www.domain.com so i needed to set the cookie domain in phpbb to just be > ".domain.com" so both sites can access it. The trouble is when using > cookies[] in rails, it defaults to www.domain.com. How do I tell > cookies[] > that i want domain ".domain.com" instead ? > > thanks > adamThis page on the WIKI may help. http://wiki.rubyonrails.com/rails/pages/PhpBB+Integration -- Posted via http://www.ruby-forum.com/.
yes thats what i was reading. but it doesnt discuss the situation where the forums are under one subdomain, and the rails site is on another. I think in this config the forums are installed in /public which keeps everything under one domain which is not how i have it setup. I have a page with an IFRAME to the forums in another docroot (forums.domain.com). That is why i have the subdomain cookie issue. adam On 3/9/06, Jeff Jones <rurounijones@hotmail.com> wrote:> > Adam Denenberg wrote: > > Does anybody know how to access the domain of a cookie from inside > > rails? > > > > I am try to integrate phpbb forums into my site and one of the things > > phpbb > > does is store a cookie. The forums are at forums.domain.com and the > > site is > > www.domain.com so i needed to set the cookie domain in phpbb to just be > > ".domain.com" so both sites can access it. The trouble is when using > > cookies[] in rails, it defaults to www.domain.com. How do I tell > > cookies[] > > that i want domain ".domain.com" instead ? > > > > thanks > > adam > > This page on the WIKI may help. > > http://wiki.rubyonrails.com/rails/pages/PhpBB+Integration > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060309/c820ceec/attachment-0001.html
for the sake of saving someone else the trouble here is what i had to do:
cookies[:mycookiename] = { :value => nil, :expires => Time.now, :domain
=>
".domain.com" }
hope it helps someone else. My hunch is there is a way to set a default
domain in environment.rb but i havent figured that out yet.
adam
On 3/9/06, Adam Denenberg <straightflush@gmail.com>
wrote:>
> yes thats what i was reading. but it doesnt discuss the situation where
> the forums are under one subdomain, and the rails site is on another. I
> think in this config the forums are installed in /public which keeps
> everything under one domain which is not how i have it setup. I have a
page
> with an IFRAME to the forums in another docroot ( forums.domain.com).
> That is why i have the subdomain cookie issue.
>
> adam
>
>
> On 3/9/06, Jeff Jones < rurounijones@hotmail.com> wrote:
> >
> > Adam Denenberg wrote:
> > > Does anybody know how to access the domain of a cookie from
inside
> > > rails?
> > >
> > > I am try to integrate phpbb forums into my site and one of the
things
> > > phpbb
> > > does is store a cookie. The forums are at forums.domain.com and
the
> > > site is
> > > www.domain.com so i needed to set the cookie domain in phpbb to
just
> > be
> > > ".domain.com" so both sites can access it. The trouble
is when using
> > > cookies[] in rails, it defaults to www.domain.com. How do I tell
> > > cookies[]
> > > that i want domain ".domain.com" instead ?
> > >
> > > thanks
> > > adam
> >
> > This page on the WIKI may help.
> >
> > http://wiki.rubyonrails.com/rails/pages/PhpBB+Integration
> >
> > --
> > Posted via http://www.ruby-forum.com/.
> > _______________________________________________
> > Rails mailing list
> > Rails@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060309/9d02544d/attachment.html
Adam Denenberg <straightflush@...> writes:> for the sake of saving someone else the trouble here is what i had to > do:cookies[:mycookiename] = { :value => nil, :expires => Time.now, :domain => > ".domain.com" }hope it helps someone else. My hunch is there is a way to > set a default domain in environment.rb but i havent figured that out yet>From "Agile Web Development With Rails", under "Available session options"::session_domain: The domain of the cookie used to store the session id on the browser. Defaults to the application''s host name: ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_domain] ''.domain.com'' AWDR is a *must* have for anyone working with Rails. I bought the PDF version directly from pragprog and it was worth every cent. http://www.pragmaticprogrammer.com/titles/rails/ -- Pazu <pazu@pazu.com.br>