Forum: Ruby on Rails Cookies are broken

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
zkarcher (Guest)
on 2005-11-12 12:49
(Received via mailing list)
Hi all,
I'm getting errors whenever I try to do anything with cookies. Here is
the offending code fragment, this is in app/helpers/news_helper.rb :

- - -

def last_survey_answered
  if cookies[:survey_answered]
    return cookies[:survey_answered]
  end
  return 0
end

- - -

I have also tried simple cookie commands such as:
cookie[:test] = "Hi" . The error I'm getting is:


undefined local variable or method `cookies' for
#<#<Class:0x25b8ca8>:0x25b8870>


Do I need to install a gem?? I tried upgrading rails to the latest
version (0.14.3) and the error is the same. Please help. Thanks

-- Zach
89de5e9d3a68b51ea436d807480de3ef?d=identicon&s=25 Joe B. (joe-black)
on 2005-11-24 20:23
i think you miss a 's'
cookies[:test] = "Hi"
E13e9e580e5a73d0074a2a4a55becef9?d=identicon&s=25 John H. (jh100000)
on 2006-04-20 22:37
Joe Black wrote:
> i think you miss a 's'
> cookies[:test] = "Hi"


still doesn't work... its driving me mad too.
This topic is locked and can not be replied to.