save object reference in db?

Discussion in 'Ruby' started by Jamal Soueidan, Oct 27, 2008.

  1. 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-forum.com/.
     
    Jamal Soueidan, Oct 27, 2008
    #1
    1. Advertisements

  2. 2008/10/27 Jamal Soueidan <>:
    > 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
     
    Robert Klemme, Oct 27, 2008
    #2
    1. Advertisements

  3. Robert Klemme wrote:
    > 2008/10/27 Jamal Soueidan <>:
    >> 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-forum.com/.
     
    Brian Candler, Oct 27, 2008
    #3
  4. 2008/10/27 Brian Candler <>:
    > Robert Klemme wrote:
    >> 2008/10/27 Jamal Soueidan <>:
    >>> 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
     
    Robert Klemme, Oct 27, 2008
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ce
    Replies:
    1
    Views:
    3,174
  2. Cengiz
    Replies:
    0
    Views:
    451
    Cengiz
    Jul 25, 2003
  3. Cengiz
    Replies:
    2
    Views:
    729
    Joseph Millar
    Jul 26, 2003
  4. Replies:
    1
    Views:
    720
    Mark Rae [MVP]
    Sep 20, 2007
  5. Arv
    Replies:
    15
    Views:
    1,141
    James Kanze
    Mar 7, 2008
  6. Eric Mahurin
    Replies:
    4
    Views:
    435
    David A. Black
    May 6, 2005
  7. Sean
    Replies:
    2
    Views:
    226
    Dr John Stockton
    Sep 20, 2004
  8. poldo

    Save an object Reference to DOM

    poldo, Feb 20, 2008, in forum: Javascript
    Replies:
    1
    Views:
    250
    Martin Honnen
    Feb 20, 2008
Loading...