Forum: Rails Engines edit roles errors

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
C31c7255fa4488dfc5d766403b497a36?d=identicon&s=25 Jim Morris (wolfmanjm)
on 2006-03-29 01:50
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

<p><label for="role_omnipotent">Omnipotent</label><br/>
<%= check_box 'role', 'omnipotent' %></p>

<p><label for="role_system_role">System Role</label><br/>
<%= check_box 'role', 'system_role' %></p>

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)
This topic is locked and can not be replied to.