我注意到我的应用程序会自动将所有流程设置为在创建后立即完成。我浏览了一下,找不到为什么在没有被告知的情况下更新日期,但我发现我的观点之一是寻找一个不存在的字段。我创建了“完整”字段,将其设置为非空布尔值,然后再次尝试。
我再次将其自动设置为 true,因此我尝试在 create 方法中将其显式设置为 false,但这仍然不起作用:S 所以我尝试将隐藏字段放入表单中。即使正在提供该值,我现在仍收到“列不能为空”错误。
正如您所看到的,显然有一个完整值的参数。我缺少什么?
Error:
Mysql::Error: Column 'complete' cannot be null: INSERT INTO `decommissions` (`completed_at`, `keep_backups`, `services_stopped`, `updated_at`, `operating_system_id`, `comments`, `username`, `disposition`, `stakeholder_email`, `complete`, `alias`, `storage`, `model_id`, `contract_maintenance`, `created_at`) VALUES(NULL, 1, 1, '2010-10-18 00:32:37', 1, NULL, NULL, '', 'tes[email protected] /cdn-cgi/l/email-protection', NULL, 'test1', '', 1, '', '2010-10-18 00:32:37')
参数:
{"decommission"=>{"dns_items_attributes"=>{"0"=>{"ip"=>"131.181.185.111",
"alias"=>"test",
"retain"=>"1",
"_destroy"=>""}},
"keep_backups"=>"1",
"services_stopped"=>"1",
"operating_system_id"=>"1",
"stakeholder_email"=>"[email protected] /cdn-cgi/l/email-protection",
"alias"=>"test1",
"model_id"=>"1"},
"commit"=>"Submit",
"authenticity_token"=>"cMMf0zS/5jPExlXqVPaYVXndqPeVkm+OQ/WEPIYd2+g=",
"disposition"=>"Dispose",
"complete"=>"false",
"storage"=>"Local",
"contract_maintenance"=>"0"}
当我将以下内容放入创建控制器时,它呈现“true”:
@decommission = Decommission.new(params[:decommission])
@decommission.complete = false
render :text => @decommission.complete