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

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

I’ve included ActiveRecord::Base.set_sequence_name in my environment.rb,
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

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

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

FexecMain.c L1795 RExecConstraints: INSERT INTO usertbl

Oh my head hurts!!



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs