Hello,
I have a model with a JSONB column. I'd like to be able to access this
column as both a hash and a class (let's say an openstruct for the example).
I can do it the obvious way (with a location JSONB column)
def location_struct=(loc)
self.location = loc.to_h
end
def location_struct
location && OpenStruct.new(location).freeze
end
But it's not very friendly.
Do you have any best practice for this kind of scenario or is the above
approach not that bad (in a plugin)?
Regards
--
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/d/optout.