ruckus/active_record_hstore_serializer

deleting key

Closed this issue · 1 comments

Looking at this, looks really cool, too bad Heroku only has hstore in limited private beta

How do you delete a key?

This library does not provide a Ruby way to delete a key, although it would be easy to add. And I will add it to my list.

For now you will need to use some SQL and use the Postgres HStore methods for deleting a key:

http://www.postgresql.org/docs/9.1/static/hstore.html

So its basically

UPDATE profiles SET bio = delete(bio, 'age') WHERE id = 1

Since delete returns the modified hstore you can just assign it back.