Hi all.
I have table without in my DB.
Rails try to use non-existent sequence and try to write value into
non-existent primary key. And i have DB error.
How to use model with such table?
I try
set_sequence_name nil
set_primary_key nil
and
set_sequence_name “”
set_primary_key “”
Why don’t you just add a primary key?
I did not create DB. I can’t modify it, only use.
If you don’t have a primary key, how do you find entries in the database?
I use SQL
Did you or a DBA create a compound one instead of a simple one?
Or, did you have a compound one all along?
No.
Table had not any PK.
Table has not any PK now.
I tried use set_primary_key :column_name but it didn’t work. When i
tried to save row i had got error. I don’t know why.
I tried use this gem and use set_primary_keys :column_name - it
works.
Win with
set_primary_keys - tool for composite primary key
gem --install composite_primary_keys
I agree that this is a great gem, but you wrote that your table
didn’t have a primary key. Did you or a DBA create a compound one
instead of a simple one? Or, did you have a compound one all along?
Craig
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.