[Nitro] Og UUIDs

George Moschovitis george.moschovitis at gmail.com
Tue Apr 24 17:57:33 EDT 2007


it is a bit difficult to follow (and reply to) emails these days, but let me

Next question:
> Why create a special module for UUIDs?  (except the reason that
> create_p_k has to be available).  The first thing that came to my
> mind on how to use UUIDs:
> class MyModel
>    attr_accessor :oid, UUID, :primary_key => true
> end
> And Og handling the rest via the typemap.
> Together with a `autoload :UUID, 'uuidtools'` somewhere in Og...

One of the ideas of the new versionof Nitro/Og is to reuse standard Ruby
idioms (like modules). There is an Og option that automatically includes the
UUID mixin to your classes (this is what I use). But i think:

class MyModel
  include UUIDPrimaryKey

is very readable. I could handle the notation you suggest but I don't really
see the point to add this custom behaviour when the standard ruby idiom is
more than enough.

Ah, and I absolutely hate the to 22 encoder, it doesn't preserve
> the orderability of the time-uuids.  ;/  But I guess that's the
> price you pay for not using more bytes..

you have a point here, but I *really* love the uuids. If someone can suggest
a better encoder  I would like to hear about it.

-g (enjoying his last few 'free' days ;-))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070425/ef671bd8/attachment.html 

More information about the Nitro-general mailing list