Forum: Rails Engines edit roles errors

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jim M. (Guest)
on 2006-03-29 03: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
fields...

<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.