[Nitro] help with og!

zimba-tm zimba.tm at gmail.com
Mon Dec 5 15:13:48 EST 2005

On 05/12/05, TRANS <transfire at gmail.com> wrote:
> > So Og can create an empty object, and detect the attribute's types.
> > What do you think of that idea ?
> If I understand what you're proposing...
> It's tricky. You still need a way to exclude/include attributes and if
> you depend soley on the type of the attribute itself what happens if
> its not the same type as the field in the DB? --which can happen if
> another object of same class had a different type of value for an
> attribute previously.

Ok, you understood what I meant. I'm not sure it's an ideal solution,
but I'm here to talk about it.

Basically, here is how my idea would look like :

class Item
  def initialize(*args) # or ( name='', price = 0.00, once = Type::Ignore )
    @name = '' # or Type::String
    @price = 0.00 # or Type::Float
    @once = Type::Ignore

Finally, what happens in the actual Og implementation when a data type
given is not compatible with the database field format ? I see three
possibilities :
1) Define transformations to the desired storage format
2) Dump the invalid data
3) Add a dump field to put the invalid data inside


More information about the Nitro-general mailing list