Closed Bahanix closed 10 years ago
Interesting, are you on Rails 4 ?
I should have stated it explicitly in the readme, but HStore and JSON columns are only with Rails 4+
Yes: rails 4.0.2 pg 0.17.1 activerecord-typedstore 0.4.2
That's really weird. It works in my tests: https://github.com/byroot/activerecord-typedstore/blob/a93f48548d9a451e1b281875f0cb13966fa200eb/spec/active_record/typed_store_spec.rb#L630
I'll try to figure out what's going on. In the meantime if you could provide a minimal app that trigger the issue, that would help a lot. In any case I'll do my best to fix that ASAP.
Here's the minimal app: https://github.com/Bahanix/typed-hstore
Thank you!
@Bahanix thanks a lot. Actually HStore was not properly tested because of a broken condition in my test suite :sob:
I now have a failing test suite: #12. I have to flee to work now, but be certain that I'll fix that as soon as I get a couple hours ahead of me.
In the meantime, I would recommend to use the JSON type instead, if it suits your needs. Here's an example of how to use it: https://github.com/byroot/activerecord-typedstore/blob/a93f48548d9a451e1b281875f0cb13966fa200eb/spec/support/models.rb#L143
@Bahanix so I found the issue.
HStore serilization like for JSON columns is handled at the driver level, so you need to define a custom identity coder.
I added a REAME section about that: https://github.com/byroot/activerecord-typedstore#serialization-methods
I'm really sorry that it took so long, I should have written that readme entry a while ago.
In the future I'll see what I can do to detect HStore and JSON columns to prive a default coder.
Thanks for using typed-store!
It works, thank you very much!
Profile#properties is a PG hstore. If I remove the typed_store block from model, all seems to work well. Did I do something wrong?
Here typed_store seems perfect to retreive data but not to set data.
The same at activerecord-typedstore master.