Hi
According to rdoc: value - the cookie''s value or list of values (as an
array).
So, I can use arrays, briliant.
But.... It does not work (at least on webrick)
I wrote a controller:
def check_cookies_first
cookies[:chef] {:value => ["first",
"second"], :expires => Time.local
(2020)}
render_text ":)"
end
def check_cookies_second
begin
render_text "cookies class is: " +
cookies[:chef].class.to_s + "
value: " + cookies[:chef]
rescue Exception => e
render_text "Why this don''t work? exception: " +
e.to_s
end
end
Started server:
get check_cookies_first ---> ":)"
get check_cookies_second ---> "cookies class is: String value:
first"
What is wrong? Is it a webrick issue?
Thanks a lot,
Szczepan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060107/732b3224/attachment.html
if you add this method,
def cookie(name)
@cookies[name.to_s].value if @cookies[name.to_s] &&
@cookies[name.to_s].respond_to?(:value)
end
to the CookieJar class in the cookies.rb file
you would be able to access the entire cookie array.
cookies.cookie(:chef)
=> ["first", "second"]
Szczepan Faber wrote:
> Hi
>
> According to rdoc: value - the cookie''s value or list of values
(as an
> array).
>
> So, I can use arrays, briliant.
> But.... It does not work (at least on webrick)
>
> I wrote a controller:
>
> def check_cookies_first
> cookies[:chef] > {:value => ["first",
"second"], :expires =>
> Time.local(2020)}
>
> render_text ":)"
> end
>
> def check_cookies_second
> begin
> render_text "cookies class is: " +
cookies[:chef].class.to_s
> + " value: " + cookies[:chef]
> rescue Exception => e
> render_text "Why this don''t work? exception: "
+ e.to_s
> end
> end
>
> Started server:
>
> get check_cookies_first ---> ":)"
> get check_cookies_second ---> "cookies class is: String value:
first"
>
> What is wrong? Is it a webrick issue?
>
> Thanks a lot,
> Szczepan
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
Surely there is an other way?? If not is this then not just a bug? Lou Vanek wrote:> if you add this method, > > def cookie(name) > @cookies[name.to_s].value if @cookies[name.to_s] && > @cookies[name.to_s].respond_to?(:value) > end > > to the CookieJar class in the cookies.rb file > you would be able to access the entire cookie array. > > cookies.cookie(:chef) > > => ["first", "second"]-- Posted via http://www.ruby-forum.com/.