I am using the activerecord-postgres-hstore gem with rails 3.2. I have setup hstore and when I try and save any data I get the error:
ActiveRecord::StatementInvalid in ProductsController#create
PG::Error: ERROR: Syntax error near 'a' at position 4
: INSERT INTO "products" ("created_at", "name", "price", "properties", "updated_at")
VALUES ($1, $2, $3, $4, $5) RETURNING "id"
In this case I have 'properties' defined as an hstore data type. I have seen this error with both postgresl 8.4 and 9.1. Any info appreciated.
Adding the code " serialize :data, ActiveRecord::Coders::Hstore" from Rails 3.2 Postgres Save Error "ActiveRecord::StatementInvalid: PG::Error: ERROR: Syntax error near 'T' at position 5" solved my issue. I just had the wrong model name when I initially tried this as a fix.