I have an existing database in Oracle. All the tables have triggers
that insert the next value from the table sequence into the id column.
I have told rails about the sequence using set_sequence_name.
The problem occurs when rails trys to insert a new row. It grabs the
nextval from the sequence and uses that in its INSERT sql, BUT then the
oracle trigger trigger automatically takes over (as it should) and grabs
the next value from the sequence and forces it into the inserted row.
This results in rails having the wrong id for that record. The id that
rails has is minus one from what it should be.
My current solution is to minus one from the model’s id when i need to
use it subsequently. This is not an ideal solution and is a real ball
Is there any way around this problem with ActiveRecord? or is there a
very clever way round it?
Any advice would be useful.