[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

save object reference in db?

Jamal Soueidan

10/27/2008 12:16:00 PM

Hi everyone,

I want to ask if it's possible to save object reference in database for
later use?

Regards,
Jamal
--
Posted via http://www.ruby-....

3 Answers

Robert Klemme

10/27/2008 1:14:00 PM

0

2008/10/27 Jamal Soueidan <jamal@soueidan.com>:
> I want to ask if it's possible to save object reference in database for
> later use?

No, not directly. How should that work?

You either need an OR mapper (for example ActiveRecord) or you store
complete object graphs serialized (via Marshal in a BLOB or YAML in a
CLOB).

Cheers

robert

--
remember.guy do |as, often| as.you_can - without end

Brian Candler

10/27/2008 2:14:00 PM

0

Robert Klemme wrote:
> 2008/10/27 Jamal Soueidan <jamal@soueidan.com>:
>> I want to ask if it's possible to save object reference in database for
>> later use?
>
> No, not directly. How should that work?

Well, technically it *is* possible to save object references - see
weakref.rb for an implementation.

But this is almost certainly not what the OP wants (since those object
references won't survive garbage collection, or application restart)
--
Posted via http://www.ruby-....

Robert Klemme

10/27/2008 3:49:00 PM

0

2008/10/27 Brian Candler <b.candler@pobox.com>:
> Robert Klemme wrote:
>> 2008/10/27 Jamal Soueidan <jamal@soueidan.com>:
>>> I want to ask if it's possible to save object reference in database for
>>> later use?
>>
>> No, not directly. How should that work?
>
> Well, technically it *is* possible to save object references - see
> weakref.rb for an implementation.

Hey, normally *I* am supposed to be the nitpick! What's the point in
storing something that you cannot reasonably retrieve? This is only
useful for a WOM. *gg*

> But this is almost certainly not what the OP wants (since those object
> references won't survive garbage collection, or application restart)

Exactly!

Kind regards

robert


--
remember.guy do |as, often| as.you_can - without end