Rails: breaking restrictions for creating but not updating

Note: This is a "rail" (and more concise) version of this question that has been dragging on for a while.

I get Rails behavior on a production server, on which I cannot replicate on the development server. The codebases are identical except for credentials and caching settings, and both are based on an Oracle 10g database with the same design (but with different data).

The My Rails application contains a custom model that has registration; registration in turn has_and_belongs_to_many company_ownerships through the registration_ownerships table. After registering, users fill out data relevant to all three models, including a series of flags indicating which accounts can be applied to their account.

On the dev server, the registration process is seamless, no matter what data is entered. However, during production, if users check any fields of the company’s property before sending their registration, Oracle complains about the violation of the restrictions on the primary key of the company_ownerships table (which is a two-key key based on company_ownership_id and registration_id) and users get a standard Rails 500 error screen. In each In the case, I checked that the production database does not have an inconsistent record for these two fields, so I do not know why the restriction is violated.

To make things even more confusing, if a user registers without listing any possessions, and then returns and changes their account to reflect ownership data (which are executed through the same interface), the application will gladly match their request, and Oracle - (this is both in production and in dev).

I spent the last couple of days trying to figure out what might cause this problem, and I get to the end of my wit. Any advice would be greatly appreciated!

UPDATE 4/15/10: I just noticed something that might be helpful. I tried to register identical accounts on dev and production and intentionally left the phone field blank, which is a required field. On dev, I received the following message:

1 error prevented this registration from being saved

:

  • .

:

2

:

  • .
  • .

, - , , , , , , . , , Rails, Oracle?

+3
2

, "", ; , ( "registrations_2349871.rb" - ) Rails (, ..) , ! . - .

0

-, , , .

-, , . , ,

create table test_pk (pk_1 number(3,0), pk_2 number(3,0), val varchar2(20));
alter table test_pk add constraint test_pk_pk primary key (pk_1, pk_2);
insert into test_pk values (10.1, 10.1, 'test 10.1');
insert into test_pk values (10.2, 10.2, 'test 10.2');

, . , . , - (, a, b, a b .)

+1

Source: https://habr.com/ru/post/1740992/


All Articles