Edit roles errors


#1

When I try to add a new role I get the attached error. The problem is
that postgresql doesn’t like the NULL being passed in for the two non
null columnds omnipotent and system_role, even though they have a
default set to false, this is overriden by the INSERT SQL statement
explicitly setting those columns to NULL.

The work around I have used is to simply add two checkboxes for those
fields…

Omnipotent
<%= check_box 'role', 'omnipotent' %>

System Role
<%= check_box 'role', 'system_role' %>

to the app/views/role/new.rhtml

the error I get when I try to create the new role was…

PGError: ERROR: ExecInsert: Fail to add null value in not null
attribute omnipotent
: INSERT INTO roles (“name”, “omnipotent”, “description”, “system_role”)
VALUES(‘Exec’, NULL, ‘Executive’, NULL)