I noticed that my application was automatically setting all my processes to having been completed as soon as they were created. I looked through it, couldn't find why the date was being updated without being told to, but I found that one of my views was looking for a field that didn't exist. I created the 'complete' field, set it as a not null boolean and tried again.
I was getting it being set automatically to true again so I tried setting it as false explicitly in the create method, this still didn't work :S so I tried putting a hidden field into the form. I am now getting a "column cannot be null" error even though the value is being provided.
As you can see there is clearly a parameter for the complete value. What am I missing?
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, '', '[email protected]', NULL, 'test1', '', 1, '', '2010-10-18 00:32:37')
Parameters:
{"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]",
"alias"=>"test1",
"model_id"=>"1"},
"commit"=>"Submit",
"authenticity_token"=>"cMMf0zS/5jPExlXqVPaYVXndqPeVkm+OQ/WEPIYd2+g=",
"disposition"=>"Dispose",
"complete"=>"false",
"storage"=>"Local",
"contract_maintenance"=>"0"}
When I put the following in my create controller it renders 'true':
@decommission = Decommission.new(params[:decommission])
@decommission.complete = false
render :text => @decommission.complete