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ć 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