Forum: Ruby on Rails Problem with set-cookie?

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.
Joa C. (Guest)
on 2009-06-08 12:34
Hello everyone,

I'm a beginner in Ruby on Rails and I have a little problem when I
update my application RoR in my server. Can you help me please?

My problem is:

When I code my application in my computer: It's ok.
When I update my application in my server I have a "bug" with cookies.

When a user come in my website for the first time, I initialize some
cookies. But in my server I have a message in my page and the cookies
isn't initialize:

Set-Cookie: boite=1-2; path=/ Set-Cookie:
_mileva2_session_id=BAh7CDoPc2Vzc2lvbl9pZCIlMzAyYjdlMjNiMzg5MDZlM2I3OTZlYTY4MzZkYjdkMjciCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA6EF9jc3JmX3Rva2VuIjFHTDY3TmcvclhXeXIwTG5YcDlmbzBkOFU1eW1VQkNYNUVhU2d2Qm1DdUIwPQ%3D%3D--2ea57948c303a0b69628eb3b8798eba64ef4dd44;
path=/; HttpOnly

It's working perfectly in my computer and I searched the problem in
different place but no result :(

My version of rails is 2.3.2.

A fragment of my code where I initialize the cookies:

In welcome_controller.rb
# 3 # Dans le cas où j'ai ni cookie, et que je suis pas loggué
boite = Box.find( :all,
:conditions => "capsules.admin = '1' && boxes.user_id = '0'",
:order => 'position',
:group => 'capsule_id',
:joins => "inner join capsules on boxes.capsule_id = capsules.id" )
@box = boite

# Pour créer les starters et les closers
@number = 8 - boite.length

# Initialisation des cookies
cookies[:user] = 'mileva'
cookie_text = ""
j = 0
for box in boite
if(j >= 1)
cookie_text = cookie_text + "-"
end
cookie_text = cookie_text + box.capsule.id.to_s
j = j + 1
end

cookies[:boite] = cookie_text

You can see the error in www.mileva.eu (Warning, if you don't visit for
the first time, you have to clear your cookies)

Thank you and Have fun

Joachim
Matt J. (Guest)
on 2009-06-08 20:41
(Received via mailing list)
Your server is running an old version of Passenger (2.0.6); this is a
known issue with that version and Rails 2.3.2. Upgrading to the latest
Passenger will fix it.

--Matt J.
Joa C. (Guest)
on 2009-06-08 21:17
Thank you Matt, I will try it :)
This topic is locked and can not be replied to.