rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / code / Atom feed
* "singleton can't be dumped" error when storing an object in session
@ 2012-05-26  9:39 armanx
  2012-05-29 22:42 ` armanx
  0 siblings, 1 reply; 3+ messages in thread
From: armanx @ 2012-05-26  9:39 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

Hello everyone,

I'm using Rack::Session::Cookie to store an object (a Sequel model returned 
by a database call) in the session. However, I'm getting a "singleton can't 
be dumped" error when trying to do so. What is the reason for this error?

The interesting thing is, I only get the error when the Sequel object is 
first saved in the database then returned; the error is absent when the 
record already exists in the database and is returned via select (without 
saving), yet in both cases the objects/classes are identical.

[-- Attachment #2: Type: text/html, Size: 577 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: "singleton can't be dumped" error when storing an object in session
  2012-05-26  9:39 "singleton can't be dumped" error when storing an object in session armanx
@ 2012-05-29 22:42 ` armanx
  2012-05-30  7:53   ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: armanx @ 2012-05-29 22:42 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

Is it possible that the object is too large for the 4kb cookie size limit 
and that's what is causing this error?

On Saturday, May 26, 2012 2:39:08 AM UTC-7, armanx wrote:
>
> Hello everyone,
>
> I'm using Rack::Session::Cookie to store an object (a Sequel model 
> returned by a database call) in the session. However, I'm getting a 
> "singleton can't be dumped" error when trying to do so. What is the reason 
> for this error?
>
> The interesting thing is, I only get the error when the Sequel object is 
> first saved in the database then returned; the error is absent when the 
> record already exists in the database and is returned via select (without 
> saving), yet in both cases the objects/classes are identical.
>

[-- Attachment #2: Type: text/html, Size: 883 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: "singleton can't be dumped" error when storing an object in session
  2012-05-29 22:42 ` armanx
@ 2012-05-30  7:53   ` Eric Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Wong @ 2012-05-30  7:53 UTC (permalink / raw)
  To: rack-devel

armanx <armanx@gmail.com> wrote:
> On Saturday, May 26, 2012 2:39:08 AM UTC-7, armanx wrote:
> > I'm using Rack::Session::Cookie to store an object (a Sequel model 
> > returned by a database call) in the session. However, I'm getting a 
> > "singleton can't be dumped" error when trying to do so. What is the reason 
> > for this error?

(top-posting corrected)

You need to look up the definition of a singleton object.

> > The interesting thing is, I only get the error when the Sequel object is 
> > first saved in the database then returned; the error is absent when the 
> > record already exists in the database and is returned via select (without 
> > saving), yet in both cases the objects/classes are identical.

Not a Sequel expert here, but could it be Sequel is giving you a
different return value than what you expect?  Can you share this
piece of code that's giving you trouble?

> Is it possible that the object is too large for the 4kb cookie size limit 
> and that's what is causing this error?

No, based on your error, it's not too large.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-30  7:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-26  9:39 "singleton can't be dumped" error when storing an object in session armanx
2012-05-29 22:42 ` armanx
2012-05-30  7:53   ` Eric Wong

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/rack.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).