Unable to edit administrator via user administration panel
Created by: Spy-Seth
As an administrator, if I try to edit myself (the current administrator account) in the user edit panel in the admin area, I trigger this error :
Started PATCH "/admin/users/spy-seth" for 217.xxx.xxx.xxx at 2014-02-24 14:09:30 +0100
Processing by Admin::UsersController#update as HTML
Parameters: {
"utf8"=>"✓",
"authenticity_token"=>"[...]",
"user"=>{
"name"=>"[...]",
"username"=>"[...]",
"email"=>"[...]",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]",
"projects_limit"=>"1000",
"can_create_group"=>"1",
"skype"=>"[...]",
"linkedin"=>"[...]",
"twitter"=>"[...]",
"website_url"=>"http://forgebinaire.net"
},
"id"=>"[...]"
}
PG::Error: ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « admin »
: UPDATE "users" SET "admin" = $1, "projects_limit" = $2, "updated_at" = $3 WHERE "users"."id" = 1
Completed 500 Internal Server Error in 60ms
ActiveRecord::StatementInvalid (PG::Error: ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « admin »
: UPDATE "users" SET "admin" = $1, "projects_limit" = $2, "updated_at" = $3 WHERE "users"."id" = 1):
app/controllers/admin/users_controller.rb:74:in `block in update'
app/controllers/admin/users_controller.rb:73:in `update'
app/controllers/application_controller.rb:57:in `set_current_user_for_thread'
It seems the "admin" field is missing in the query.
This is cause by the "disabled" attibute on the "admin" checkbox. When I remove this attribute in the DOM before send the form. All works fine.
That probably because a disabled HTML checkbox is not send by the browser in a form.