[英]Invalid statement with Postgres hstore and rails
我正在使用帶有rails 3.2的activerecord-postgres-hstore gem。 我已經設置了hstore,當我嘗試保存任何數據時,我收到錯誤:
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"
在這種情況下,我將'properties'定義為hstore數據類型。 我已經在postgresl 8.4和9.1中看到了這個錯誤。 任何信息贊賞。
從Rails 3.2添加代碼“serialize:data,ActiveRecord :: Coders :: Hstore” Postgres保存錯誤“ActiveRecord :: StatementInvalid:PG ::錯誤:錯誤:位置 5''T '附近的語法錯誤”解決了我的問題。 當我最初嘗試將其作為修復程序時,我的模型名稱錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.