嗨,我有一个 postgres 语法错误,我在使用 HSTORE 时似乎无法追踪
错误:
2.0.0p247 :021 > e.save
(218.8ms) BEGIN
SQL (219.8ms) INSERT INTO "communications" ("created_at", "incoming", "properties", "type", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["created_at", Thu, 19 Sep 2013 23:49:14 EST +10:00], ["incoming", true], ["propertie
s", "{\"to\":\"First email test!\"}"], ["type", "Email"], ["updated_at", Thu, 19 Sep 2013 23:49:14 EST +10:00]]
PG::InternalError: ERROR: Syntax error near 'e' at position 13
: INSERT INTO "communications" ("created_at", "incoming", "properties", "type", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
(218.4ms) ROLLBACK
当我尝试保存电子邮件记录时,该错误来自 rails 控制台,在我的应用程序中,电子邮件继承自通信模型,并且记录存储在数据库的“通信”表中。
楷模:
class Communication < ActiveRecord::Base
belongs_to :patient
belongs_to :practice
end
和...
class Email < Communication
store_accessor :properties, :to, :cc, :bcc, :message, :subject
end