Rails: 3.2.6. I had to use the serializer on the gem from rubygems.org even though the README implies that you would only need to do that if you are using the 'development' version. Do we always need to use the serializer now? If so perhaps a documentation update?
The model that tripped me up for a minute at first:
class Page < ActiveRecord::Base
validates_presence_of(:type, :data); belongs_to(:user, readonly: true)
end
It was a simple model, yes it was using a OpenStruct or SuperStruct (my own beefed up custom version of OpenStruct) but I had added [to|from]_hstore to work around potential issues... Even when I was working with a raw hash I would always get:
INSERT INTO "pages" ("data", "type") VALUES ($1, $2) RETURNING "id" [["data", {"slug"=>"Test"}], ["type", "page"]]ActiveRecord::StatementInvalid: PG::Error: ERROR: Syntax error near 's' at position 4
That is, until I implemented the serializer and it started turning it properly.
Rails: 3.2.6. I had to use the serializer on the gem from rubygems.org even though the README implies that you would only need to do that if you are using the 'development' version. Do we always need to use the serializer now? If so perhaps a documentation update?
The model that tripped me up for a minute at first:
It was a simple model, yes it was using a OpenStruct or SuperStruct (my own beefed up custom version of OpenStruct) but I had added [to|from]_hstore to work around potential issues... Even when I was working with a raw hash I would always get:
INSERT INTO "pages" ("data", "type") VALUES ($1, $2) RETURNING "id" [["data", {"slug"=>"Test"}], ["type", "page"]]
ActiveRecord::StatementInvalid: PG::Error: ERROR: Syntax error near 's' at position 4
That is, until I implemented the serializer and it started turning it properly.