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?


Regards

Andrew

Hi,
I’ve followed the example given here:

http://ar.rubyonrails.com/classes/ActiveRecord/Base.html#M000367

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

http://localhost:3000/usertbl/new

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?


Regards

Andrew

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