I've a model for which I would like to have one of its column value
automatically converted to a more appropriate object, I'm doing something
like that (the User class is not a sequel model)
class InventoryItem < Model
def user
User.new(super)
end
def user=(v)
v.to_s
end
end
That doesn't seem the right way to do it, as every call to
InventoryItem#user or InventoryItem#user= will perform the conversion which
can be costly.
I realized that I can avoid defining #user= by doing
class User
def sql_literal(ds)
ds.literal(self.to_s)
end
end
But I'm still left clueless for InventoryItem#user
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/54c2c968-a713-4997-95af-fc829ec46b6cn%40googlegroups.com.