search for: 23000duplicate

Displaying 9 results from an estimated 9 matches for "23000duplicate".

2006 Mar 09
4
habtm questions
...e:0xb7adc610> 15: <td><%= package.bag.name%> </td> problem B: save package "A" with bag "X" associated saves save package "B" with bag "X" associated generates error ActiveRecord::StatementInvalid in Packages#update Mysql::Error: #23000Duplicate entry ''1'' for key 1: INSERT INTO bags_packages (`id`, `bag_id`, `package_id`) VALUES (1, 1, 38) clearly the value of "1" for id is bad because it should be a newly generated ID number. any idea where this is comming from? thanks -zaq -- Posted via http://www.ruby-...
2006 Mar 17
3
How to check for presence of particular value entered ?
...quot;) on form. Now name field in database is having ''unique'' constraint on it so that no 2 records with same name allowed in database. Now when I m trying to enter same name into database from my form I m getting following error. ================================ Mysql::Error: #23000Duplicate entry ''Prashant'' for key 2: INSERT INTO users (`name`, `password`) VALUES(''Prashant'', ''Twiari'') ================================ Instead of this error I want the Proper message should be displayed on same page ("Form page") with nam...
2006 Jan 23
4
won''t auto_increment
I am writing my first RoR ap and am having problems with ActiveRecord''s basic functions. The first one is that the id column is not auto incrementing. I can add one record but after that it says, "Mysql::Error: #23000Duplicate entry ''0'' for key 1"... b -- Posted via http://www.ruby-forum.com/.
2006 Oct 12
2
How do I test a unique index?
...ve payment_numbers 0, 1, 2, and 3 (but only one of each payment_number). I can enforce this with a unique index in the payments table on the combination of loan_id and payment_number. How do I enforce this in my model? When I run a unit test with just the index set I get a "Mysql::Error: #23000Duplicate entry...". I would like to have something like a validates_uniqueness_of on the combination of loan_id and payment_number. How do I do that? Thanks, Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because yo...
2006 May 17
10
HABTM << producing incorrect insert sql ?
...but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate entry ''1'' for key 1: INSERT INTO medication_dose_frequencies (`medication_frequency_id`, `id`, `medication_dose_id`) VALUES (1, 1, 354) The problem is that the primary key (''id'') is duplicated. This is happening because the sql generated by rails is not...
2006 Feb 23
4
MySQL Duplicate Key Error
...0) SELECT COUNT(*) FROM privileges [4;36;1mPrivilege Load (0.000000) [0;1mSELECT * FROM privileges LIMIT 0, 10 Rendering within layouts/privileges Rendering privileges/list [4;35;1mPrivilege Columns (0.020000) SHOW FIELDS FROM privileges [4;36;1mSQL (0.000000) [0;1mMysql::Error: #23000Duplicate entry ''1'' for key 1: INSERT INTO privileges (`created_on`, `delete`, `name`, `designation_id`, `section_id`, `updated_on`, `modify`, `id`, `create`, `description`, `department_id`, `view`) VALUES(''2006-02-22 18:21:56'', ''0'', ''Navin...
2006 Dec 28
0
problem with assert_raise in Unit Test
I''m running a simple unit test to validate that ActiveRecord raises an exception when I try and update a column with a duplicate foreign key. Inside the unit test, charge.time_logs << time_logs(:first) will generate ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry ''20'' for key 2: UPDATE time_logs SET `task_id` = 1, `date_created` = NULL, `time_charge_id` = 20, `hours` = 2.0, `log_entry` = NULL WHERE id = 2 However, assert_raise ActiveRecord::StatementInvalid do charge.time_logs << time_logs(:first) end will g...
2007 Aug 30
3
has/belongs to many sql error
...e a model Asset which has_and_belongs_to_many :tags. Tag has only one field, name. There is a table assets_tags which only has an asset_id and a tag_id. I can add a tag to one asset. If I try to add the same tag to another asset though (asset.tags << tag) I get this error: Mysql::Error: #23000Duplicate entry ''4'' for key 1: INSERT INTO assets_tags (`tag_id`, `id`, `asset_id`) VALUES (4, 4, 1)←[0m Any ideas what could be causing that? Why does that table have 3 values (where does ''id'' come from) when it''s just a join table? Why does the tag''s...
2006 Nov 04
0
ActiveRecord, insert and not auto-incremented primary keys...
...new("code" => 1, "name" => "garden1") garden.save --------------------------------------- ... gives this error: /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log'': Mysql::Error: #23000Duplicate entry ''0'' for key 1: INSERT INTO gardens (`name`) VALUES(''garden1'') (ActiveRecord::StatementInvalid) from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/mysql_adapter.rb:184:in `execute'' from /...