From: Brian Candler Date: 2010-09-04T09:19:17+09:00 Subject: Re: Read cookie P奪l Bergstr旦m wrote: > I'm sorry if I'm unclear. But I don't understand what the problem is > with my question. So let me ask again. > > Before I could get the value in a cookie, any cookie, from a browser > visiting a rails app using cgi. I used it in Rails in order to get a > unique string into the model. (Presumably a unique string which your app provided in a previous request, via Set-Cookie) > I can't use cookies[:cookie_name] for > that. As I understand it I can't do that with Rails 2.3.x ( or 3?). Are you sure? Have you tried it? The method seems to be there: http://api.rubyonrails.org/classes/ActionController/Cookies.html Or you could try request.cookies["cookie_name"] instead. However, in a rails app you rarely manipulate cookies directly. Rather you'd do: session[:foo] = "bar" By default, Rails serialises the entire session object, signs it cryptographically, and then sends it to the client as a cookie. This allows you to store sensitive information (e.g. admin rights) whilst being sure the user will not be able to tamper with it. -- Posted via http://www.ruby-forum.com/.