I have a table with a uuid primary key, stored as a binary(16), so I
created the following sequel model to manipulate human readable string
class VM < Sequel::Model(:vm)
def uuid=(v) ; super([v.delete('-')].pack('H32')) ; end
def uuid ; super.unpack('H8H4H4H4H12').join('-') ; end
end
I would have expected VM["73ec5789-7fc8-4cbd-8c5f-2b662ff377a7"]
to retrieve the corresponding vm, but it seems that I need to use the
binary form for the uuid
What would have been the proper way to define the model?
Or what should I implement to work with the dataset and have automatic
conversion?
Thank you
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.