|
List Info
Thread: Getting Session ID
|
|
| Getting Session ID |

|
2006-04-29 19:45:34 |
I thought I understood how to grab the session id but in the
following
code I am getting null for the session id:
foo
= Foo.new(:session_id => session[:session_id],
:test_id => test.id)
--
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|
|
| Getting Session ID |

|
2006-04-29 20:11:31 |
Will Merydith wrote:
> I thought I understood how to grab the session id but
in the following
> code I am getting null for the session id:
>
> foo = Foo.new(:session_id => session[:session_id],
> :test_id => test.id)
I am closer I believe:
foo
= Foo.new(:session_id => session.id], :test_id => test.id)
Now the problem is that the session id I am getting is not
what I
expect:
Processing . . . [POST]
Session ID: d3aa0519df929116ea8e63cb353a1982
INSERT INTO foo (`test_id`, `session_id`) VALUES(1,
30652084)
The session ids do not match.
--
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|
|
| Getting Session ID |

|
2006-04-29 20:27:33 |
Everything else aside... why on earth are you trying to
capture the
session id? Rails is handling the user sessions for you, all
you need
to do is work with the session object in your controllers
and views.
I honestly can't think of a single reason why I would want
to grab a
session id and then put it into one of my own tables...
-Brian
On Apr 29, 2006, at 04:11 PM, Will Merydith wrote:
> Will Merydith wrote:
>> I thought I understood how to grab the session id
but in the
>> following
>> code I am getting null for the session id:
>>
>> foo = Foo.new(:session_id => session[:session_id],
>> :test_id => test.id)
>
> I am closer I believe:
>
> foo = Foo.new(:session_id => session.id], :test_id
=> test.id)
>
> Now the problem is that the session id I am getting is
not what I
> expect:
>
> Processing . . . [POST]
> Session ID: d3aa0519df929116ea8e63cb353a1982
> INSERT INTO foo (`test_id`, `session_id`) VALUES(1,
30652084)
>
> The session ids do not match.
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|
|
| Getting Session ID |

|
2006-04-30 00:57:40 |
Will Merydith wrote:
[...]
> I am closer I believe:
>
>
> foo = Foo.new(:session_id => session.id], :test_id
=> test.id)
>
> Now the problem is that the session id I am getting is
not what I
> expect:
>
> Processing . . . [POST]
> Session ID: d3aa0519df929116ea8e63cb353a1982
> INSERT INTO foo (`test_id`, `session_id`) VALUES(1,
30652084)
>
> The session ids do not match.
The session isn't an AR instance so you're getting Ruby's
Object#id
method which isn't what you want.
I believe that session is an instance of CGI::Session so you
probably
really want session.session_id instead.
--
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|
|
| Getting Session ID |

|
2006-04-30 01:43:20 |
On Apr 29, 2006, at 5:57 PM, Mike Fletcher wrote:
> Will Merydith wrote:
> [...]
>> I am closer I believe:
>>
>>
>> foo = Foo.new(:session_id => session.id], :test_id
=> test.id)
>>
>> Now the problem is that the session id I am getting
is not what I
>> expect:
>>
>> Processing . . . [POST]
>> Session ID: d3aa0519df929116ea8e63cb353a1982
>> INSERT INTO foo (`test_id`, `session_id`)
VALUES(1, 30652084)
>>
>> The session ids do not match.
>
> The session isn't an AR instance so you're getting
Ruby's Object#id
> method which isn't what you want.
>
> I believe that session is an instance of CGI::Session
so you probably
> really want session.session_id instead.
I'm not sure what the de-facto-standard is here.. but I
typically
treat the session object as if it were a magical hash.
session[:session_id]... just like you'd do with params,
cookies, and
flash.
foo
= Foo.new( :session_id => session[:session_id], :test_id
=>
test.id )
Cheers,
Robby
Robby Russell
Founder & Executive Director
PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting
www.planetargon.com
www.robbyonrails.com
+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4968 [fax]
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|
|
| Getting Session ID |

|
2006-04-30 01:42:41 |
On Apr 29, 2006, at 5:57 PM, Mike Fletcher wrote:
> Will Merydith wrote:
> [...]
>> I am closer I believe:
>>
>>
>> foo = Foo.new(:session_id => session.id], :test_id
=> test.id)
>>
>> Now the problem is that the session id I am getting
is not what I
>> expect:
>>
>> Processing . . . [POST]
>> Session ID: d3aa0519df929116ea8e63cb353a1982
>> INSERT INTO foo (`test_id`, `session_id`)
VALUES(1, 30652084)
>>
>> The session ids do not match.
>
> The session isn't an AR instance so you're getting
Ruby's Object#id
> method which isn't what you want.
>
> I believe that session is an instance of CGI::Session
so you probably
> really want session.session_id instead.
I'm not sure what the de-facto-standard is here.. but I
typically
treat the session object as if it were a magical hash.
session[:session_id]... just like you'd do with params,
cookies, and
flash.
foo
= Foo.new( :session_id => session[:session_id], :test_id
=>
test.id )
Cheers,
Robby
Robby Russell
Founder & Executive Director
PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting
www.planetargon.com
www.robbyonrails.com
+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4968 [fax]
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|
|
[1-6]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|