I am the only one who is testing and there are no opened sessions. I am sure production DB schema and test DB schema are identical. I tested with all three environments with test DB schema, but didn’t help.
One thing to note is that after I get the RoR error message, if I just hit F5 key a few times, the insertion works and I get the next successful page.
This same app is working fine on Windows 2003 server though. (I just copied the app dir and all the RoR setup.)
It looks like there may be a unique constraint on the database (not the Ruby code)
Generally Rails is against database constraints (although there is some disagreement about this in the community). I would look for a database constraint, remove it, and see if that fixes the problem.
Database constraints are extremely valuable - it's the only way to
guarantee certain conditions (especially uniqueness).
Have you tried increasing logging level, and checking logs for what
queries are actually performed?
You can also run `rake db:schema:dump` (or even db:structure:dump) on
the production to get production database schema and verify it.
Maybe loading dump of the production database locally (if that's
possible for you - privacy, etc.) can help you debug those issues.
If I write the error message instead of xxxxxx, it is:
OCIError: ORA-00001: unique constraint (ABCSIGN_DBA.PK_ATTEND_IP) violated: INSERT INTO attend_ip (xxx, xxx, xxx, …)
The PK prefix looks like a violation of the primary key. Maybe, inserting same row again or some kind of replay happens. If so, why this is not happening in production with same code???
If I write the error message instead of xxxxxx, it is:
OCIError: ORA-00001: unique constraint (ABCSIGN_DBA.PK_ATTEND_IP) violated: INSERT INTO attend_ip (xxx, xxx, xxx, .........)
The PK prefix looks like a violation of the primary key. Maybe, inserting same row again or some kind of replay happens. If so, why this is not happening in production with same code???
How do I check if that case happens?
Daniel
In the config/environments/production.rb file, turn the log level up to debug, and restart the server, and tail the log. You should be able to see full queries and all as you hit various test pages in the site.