Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 743567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:52:44+00:00 2026-05-14T08:52:44+00:00

Note: This is a railsier (and more succinct) version of this question , which

  • 0

Note: This is a “railsier” (and more succinct) version of this question, which was getting a little long.

I’m getting Rails behavior on a production server that I can’t replicate on the development server. The codebases are identical save for credentials and caching settings, and both are powered by Oracle 10g databases with identical schema (but different data).

My Rails application contains a user model, which has_one registration; registration in turn has_and_belongs_to_many company_ownerships through a registration_ownerships table. Upon registering, users fill out data pertinent to all three models, including a series of checkboxes indicating what registration_ownerships might apply to their account.

On the dev server, the registration process is seamless, no matter what data is entered. On production, however, if users check off any of the company ownership fields before submitting their registration, Oracle complains about a constraint violation on the primary key of the company_ownerships table (which is a two-field key based on company_ownership_id and registration_id) and users get the standard Rails 500 error screen. In every case, I’ve verified that no conflicting record on these two fields exists in the production database, so I don’t know why the constraint is getting violated.

To further confuse things, if a user registers without listing any ownerships and later goes back and modifies their account to reflect ownership data (which is done through the same interface), the application happily complies with their request and Oracle is well-behaved (this is both on production and dev).

I’ve spent the past couple days trying to figure out what might be causing this problem and am reaching the end of my wits. Any advice would be greatly appreciated!

UPDATE 4/15/10: I’ve just noticed something that might be helpful. I tried registering identical accounts on dev and production and intentionally left the “phone” field blank, which is a required field. On dev, I got back the following message:

1 error prohibited this registration from being saved

There were problems with the following fields:

  • Phone can’t be blank

However, on production, I get this:

2 errors prohibited this registration from being saved

There were problems with the following fields:

  • Phone can’t be blank
  • Phone can’t be blank

My guess is that this is directly tied to the violated constraint on production–maybe as part of a commit, the field is inserted once, and then inserted again but violates the constraint the second time and then rolls back the entire transaction, removing all evidence of the initial insert. Any ideas about what might be causing this sort of behavior, either on the Rails side or on the Oracle side?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:52:45+00:00Added an answer on May 14, 2026 at 8:52 am

    As it happens, there was a spare copy of the “registrations” model lying around the directory; even though it had a different name (“registrations_2349871.rb” or something like that) Rails was running all model functionality (saving, validating, etc) twice, hence the key constraint violation! I’ve never seen behavior like this before. Deleting the rogue file solved the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Note: This is for MySQL's SQL, not SQL Server.) I have a database column
Note This is not a REBOL-specific question. You can answer it in any language.
(NOTE: This question is not about escaping queries, it's about escaping results) I'm using
Moderator note: This question is not a good fit for our question and answer
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
NOTE: this question is almost a dupe of: stop Ms Excel auto-formatting numeric strings
Note This originally started as a question about 404 errors, but now it's a
Note: This is a follow-up to an answer on a previous question . I'm
Note: This is a follow up to this question . I have a legacy
Right now I'm getting this strange behavior from IE where it's not showing my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.