Forum: Ruby How carry data between 2 page by ruby session

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
C038403192dcc27dcb9fc91b3dc9dc9d?d=identicon&s=25 Ferdous ara (ferdous)
on 2013-09-06 15:47
I am trying to carry logged_in username from one  page to different page
by cgi session.
but it does not work , can any one please tell me what i am doing wrong

page1.rb :



require 'cgi'
require 'cgi/session'

cgi =
puts cgi.header

sess = cgi, "session_key" => "user_prov",
                          "session_id"  => "9650",
                          "new_session" => true,
                          "prefix" => "web-session.")
sess["logged_id"] = "#{loged_user}"

puts "#{sess['logged_id']}"

page2.rb :  (the username should show here by session)

require 'cgi'
require "cgi/session"
print "Content-type: text/html\r\n\r\n"
sess = cgi, "session_key" => "user_prov",
                               "prefix" => "web-session.")

puts "---"
puts "#{sess['logged_id']}"

but in page2 it does not show the username ...

how can this be achieve ??

adam overstreet (Guest)
on 2013-09-06 20:11
(Received via mailing list)
Hopefully this doesn't throw a wrench in your project but I created a
project that required a login and I used the devise gem.
They have great documentation and there is a great screencast:

Good luck,
This topic is locked and can not be replied to.