How about accessing cookies from the model?

I basically want my application to have two tags:

<r:isLoggedIn> and <r:isLoggedOut>

Where the Ruby code that implements those tags (in the models
according to the tutorial) would check for the presence of certain
cookies.  But from my initial experiments, I don't have access to the
cookies variable in the model code.


Any ideas?




On 10/9/07, Sean Cribbs <[EMAIL PROTECTED]> wrote:
> You need to create a controller filter that does that.  You could do
> something like this in the activate method of your extension:
>
> ApplicationController.class_eval do
>   before_filter :set_language
>
>   def set_language
>     cookies['lang'] = 'sr' # or use params[:lang] here
>   end
> end
>
> Cheers,
>
> Sean
>
> Mirko Kirovi&#263; wrote:
> > How can I set a cookie from an extension?
> >
> > I somehow can't manage to get access to ApplicationController and as soon 
> > as I add
> >
> > request.cookies['lang'] = CGI::Cookie.new('name' => 'lang', 'value' => 'sr')
> >
> > to 'def activate' in my_extension.rb the whole thing breaks down...
> >
> >
> >
> > I need to set a cookie based on params[:lang]
> >
> >
> >
> > Greets
> >
> >
> >
> >       
> > ____________________________________________________________________________________
> > Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get 
> > listings, and more!
> > http://tv.yahoo.com/collections/3658
> > _______________________________________________
> > Radiant mailing list
> > Post:   [email protected]
> > Search: http://radiantcms.org/mailing-list/search/
> > Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> >
> >
>
> _______________________________________________
> Radiant mailing list
> Post:   [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to