[Nitro] Using Og Entities before saved to a datastore

Chris Farmiloe chris.farmiloe at farmiloe.com
Wed Sep 14 05:56:41 EDT 2005

Hi N.list

I have a little problem. I have a need to use some Entity(s) with
their relationships without saving any of their state to a datastore.

I have not found this to be possible so far? Am I the only one who has
a need for this functionality?

The only other way I can think of for achieving this end, is  
to .create all
the instances I need and destroy them after they have been used/viewed
---this brings its own problems like wasted time writing to datastore  
I have no idea how to run some code after the view is compiled....hrmm
actually i think this is what the Compiler pipelining stuff is for.  
inelegant though)

Anyways ....Some help or thoughts on this would be cool...thanx?


[see example below]

=======================> EXAMPLE <===================
class Page
   property :title, String
   has_many :paragraphs, PageParagraph

class PageParagraph
   property :content, String
   belongs_to Page

#make new page (not using .create and without any calls to .save)

p = Page.new

#make a new paragraph

txt = PageParagraph.new
txt.content = 'stuff stuff stuuff'

#assign the 'unsaved' paragraph to our new page

p.paragraphs << txt

#iterate through collection

p.paragraphs.each {|para| puts para.content }
#------------>  dies as it does a SELECT FROM using the non
#------------>  existent oid of the Page instance

==========================> END EXAMPLE <===============

More information about the Nitro-general mailing list