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

  • SEARCH
  • Home
  • 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 a long question. I've explained all the 'basics' at the top
NOTE : This question was asked from the viewpoint of ECMAScript version 3 or
Note: This question refers to a very old version of jQuery.validate() (version 1.5). This
Note: This question refers to a Rails project with Sass & Compass. Using the
(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 was originally posted in 2009, before C++11 was ratified and before
Note: This question has broadened in scope from previous revisions. I have tried to
Note: This issue appears to be limited to SQL Server 2005 SP2 I have
NOTE: This question is only loosely related to tinyxml, however including details like that

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.