我的应用程序中经常出现以下错误.如果我重新启动我的rails应用程序,这个错误将不会出现一段时间.
Rails - 3.1.3
Ruby - 1.9.3
ActiveRecord :: StatementInvalid:PG :: Error:ERROR:列"id"中的null值违反了非null约束
Directory.create(:name=>"name",:alias_name=>"name",:site_id=>2,:type=>"Directory")
(0.3ms) BEGIN
SQL (0.8ms) INSERT INTO "databases" ("alias_name", "created_at", "created_by", "id", "name", "site_id", "type", "updated_at", "updated_by") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) [["alias_name", "name"], ["created_at", Wed, 17 Apr 2013 16:46:25 IST +05:30], ["created_by", nil], ["id", nil], ["name", "name"], ["site_id", 2], ["type", "Directory"], ["updated_at", Wed, 17 Apr 2013 16:46:25 IST +05:30], ["updated_by", nil]]
PG::Error: ERROR: null value in column "id" violates not-null constraint
: …Run Code Online (Sandbox Code Playgroud)