How carry data between 2 page by ruby session

Hi
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 :

#!/usr/bin/ruby
"

#!/usr/bin/ruby

require ‘cgi’
require ‘cgi/session’

cgi = CGI.new
puts cgi.header
loged_user=“testuser”

sess = CGI::Session.new( 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)

#!/usr/bin/ruby
require ‘cgi’
require “cgi/session”
print “Content-type: text/html\r\n\r\n”
cgi=CGI.new
sess = CGI::Session.new( 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 ??

thanks

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:
http://railscasts.com/episodes/209-introducing-devise

Good luck,
Adam

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs