PostgreSQL primary (sequence) key issue (Ruby/Rails)


RuntimeError: ERROR	C23502	Mnull value in column "user_id" violates not-null constraint

FexecMain.c	L1795	RExecConstraints: INSERT INTO usertbl

Hi Guys, I’m completely stumped with this one!

I’ve included ActiveRecord::Base.set_sequence_name in my environment.rb, and in my user.rb I’ve placed the following code:

class Usertbl < ActiveRecord::Base

set_primary_key "user_id"
set_sequence_name "seq_user_mytable"
validates_uniqueness_of :userpassword, :username, :scope => :user_id

end

From [

http://localhost:3000/usertbl/new](http://localhost:3000/usertbl/new) I then attempt to enter a new a record and receive the following error message:

Oh my head hurts!!