Hi guys,
I have an app that is exhibiting this weird error. This error occures
only on production server and I can''t reproduce it on the dev server.
Basicaly I have a model object that I create from a form input, once
the model is constructed I call model.save
Then I get an error cause by lock_version set to null in the sql
insert.
These are the relevant logs:
Processing MyController#create (for ######## at 2006-09-14 17:38:03)
[POST] Session ID: 5fb74d5290110a2134cfb62a04690e3f Parameters:
{"model"=>{"created_on(2i)"=>"9",
"created_on(3i)"=>"14",
"category"=>"IMS", "title"=>"test
entry", "engineer"=>"Z",
"priority"=>"3", "id"=>"77777",
"description"=>"test description",
"created_on(1i)"=>"2006",
"comment"=>""},
"commit"=>"Create",
"action"=>"create",
"controller"=>"my_controller"}
ActiveRecord::StatementInvalid (RuntimeError: ERROR C23502 Mnull
value in column "lock_version" violates not-null constraint
FexecMain.c L1818 RExecConstraints: INSERT INTO model
("created_on", "category", "updated_at",
"audit_trail", "title",
"engineer", "lock_version", "priority",
"id", "description", "comment",
"created_at") VALUES(''2006-09-14'',
''IMS'', ''2006-09-14 17:38:03'', ''Thu
Sep 14 17:38:03 PDT 2006 Created by user1'', ''test
entry'', ''Z'', NULL, 3,
77777, ''test description'', '''',
''2006-09-14 17:38:03''))
In the db schema lock_version is defined as:
lock_version | integer | not null default 0
(I''m using PostgreSQL)
The only difference between production and dev environment is that I
had to do some manual changes in the db schema - drop some constraints+
columns (to be able to import data), but after the import I recreated
the schema to be exactly the same as the dev schema (I''ve checked this
for typos, they are the same).
Anyone has any experience with this or any idea how to solve this?
For now I put extra line into the controller''s create action that sets
lock_version to 0 before save, but this is not the way this should
work.
I don''t understand why is activerecord generating insert query with
lock_version set explicitly to null.
Thanks,
Igor
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---