PostgreSQL primary (sequence) key issue

Hi, I have a sequence set up on one of my tables called seq_user_mytable. I tried the following with no joy:

set_primary_key “user_id”, :sequence => “seq_user_mytable” and:

ActiveRecord:: Base.seq_user_mytable

again with no joy. How do I implement a sequence in Rails/ActiveRecord?

Hi, I’ve followed the example given here:

and implemented set_sequence_name “seq_name” in my class. When I try to update the user table with a new row from:


I get the following error message:

RuntimeError: ERROR	C23502	Mnull value in column "user_id" violates not-null constraint FexecMain.c	L1795	RExecConstraints: INSERT INTO usertbl

What am I overlooking here?