Displaying 10 results from an estimated 10 matches for "23000cannot".
2006 Feb 05
8
Agile Rails book: depot problem
...roblems:
I will explain them in 2 threads.
The first one is:
I can''t destroy products (I can only creat and update them). When I try
to delete a product --> http://localhost:3001/admin/destroy/3
I get this error message:
ActiveRecord::StatementInvalid in Admin#destroy
Mysql::Error: #23000Cannot delete or update a parent row: a foreign key
constraint fails (`depot_development/line_items`, CONSTRAINT
`fk_items_product` FOREIGN KEY (`product_id`) REFERENCES `products`
(`id`)): DELETE FROM products
WHERE id = 3
Can someone explain me what''s going wrong? I...
2006 Jun 12
1
Transaction save?
...,
:needbydate => Date.today
)
Crmapping.create(
:k_id => found[0].id,
:c_id => vcr,
:sys_creation_date => Date.today
)
end
Since the first record was not created when executing the second I get
error:
Mysql::Error: #23000Cannot add or update a child row: a foreign key
constraint fails...
Thanks
--
Posted via http://www.ruby-forum.com/.
2007 Jan 25
1
has_and_belongs_to won't delete records
...etting a foreign key violation when trying to delete
Order. Is there a special way of deleting orders without deleting
products? ("has_many" has :dependant => :delete_all.... does
"has_and_belongs_to" have something similar)
Trying:
Order.delete_all
Getting:
Mysql::Error: #23000Cannot delete or update a parent row: a foreign key
constraint fails: DELETE FROM orders
With associations:
class Order < ActiveRecord::Base
has_and_belongs_to_many :products
end
class Product < ActiveRecord::Base
has_and_belongs_to_many :orders
end
Thanks, Bart
--~--~---------~--~----~--...
2006 Apr 02
1
One to Many Relationship Issues
Hi,
I am having issues with a one to many relationship(it never works :-)).
Jokes aside, I am getting an error:
Mysql::Error: #23000Cannot add or update a child row: a foreign key
constraint fails: INSERT INTO adverts (`image_url`, `price`, `title`,
`website_url`, `description`, `user_id`) VALUES(''bb'', 22.0, ''aa'',
''www.drill.com/cordless'', ''bb'', 0)
The user_id...
2006 Feb 23
7
How to set a relationship with a value from a selection list
I realize this is probably a very basic problem but I''m developing my
first rails app and running into this problem.
I''m trying to write a photoblog application. I have a photo table and an
album table. Photo has a to-one relationship to Album. Photo.album_id =>
Album.id
In my view for photo I have a selection list that''s populated with all
the available albums.
2006 Jul 08
2
Creating/Saving dependent objects
...mit" %> *
* <%= end_form_tag %>
<p>
<%= button_to "Have Account", :action => :login %>
</p>
</fieldset>
</div>
*
I get the following error message on the page from the Exception (and log
file)
*Mysql::Error: #23000Cannot add or update a child row: a foreign key
constraint fails: INSERT INTO users (`hashed_pwd`, `last_login_at`, `salt`,
`username`, `firstname`, `lastname`, `address_id`, `company_id`,
`login_count`, `created_at`)
VALUES(''fce4d31d2ddf5b0ffd122189b9d575362f79c9c9'', ''2006-07-0...
2006 May 06
3
Question about one-to-many-to-many
Guys,
I''ve set up a 1-M-M relationship between 3 tables/models. I can''t get
cascading deletes (haven''t tried updates yet) to work when the master
record is deleted. I''m using MySQL 4.1.x, and the error message is:
Mysql::Error: #23000Cannot delete or update a parent row: a foreign key
constraint fails: DELETE FROM contact_addresses WHERE (contact_id = 1).
Is this something that''s not supported by MySQL? Or might I have setup
my models (has_many, belongs_to, etc.) incorrectly?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 17
0
unit_tests and deleting from the database
I get errors when running rake test_units:
test_destroy(LocationTest):
ActiveRecord::StatementInvalid: Mysql::Error: #23000Cannot delete or
update a pa
rent row: a foreign key constraint fails (`overblijf_tst/groups`,
CONSTRAINT `fk
_groups_locations` FOREIGN KEY (`location_id`) REFERENCES `locations`
(`id`)): D
ELETE FROM locations
Any pointers??
--
Posted via http://www.ruby-forum.com/.
2006 Mar 27
1
Tests not tiding up after themselves?
...conds.
1 tests, 1 assertions, 0 failures, 0 errors
$ C:\devel\motiro>ruby test/unit/headline_test.rb | more
Loaded suite test/unit/headline_test
Started
EEEEEEEEEEE
Finished in 0.531 seconds.
1) Error:
test_cache_already_recorded(HeadlineTest):
ActiveRecord::StatementInvalid: Mysql::Error: #23000Cannot delete or update a pa
rent row: a foreign key constraint fails: DELETE FROM articles
----
The article tests use the :headlines, :articles and :changes fixtures
but the headline tests only need the :headlines and :articles
fixtures. If I add the changes fixtures to the headline tests,
everything ru...
2006 Mar 22
3
Parent-Child Tables Help
...ou understand)
the color table is simply
id = 1, color = red
id = 2, color = blue ...etc.
Now i want to be able to Create a form to Add Cars
The form would have all the info pertaing to cars, along with dropdown
lists for the makes, models, colors...
i get this error when i do it
Mysql::Error: #23000Cannot add or update a child row: a foreign key
constraint fails: INSERT INTO cars (`created_on`, `number_plate`,
`price`, `title`, `updated_on`, `color_id`, `make_id`, `cc_rating`,
`description`, `negotiable`, `views`, `year`, `transmission`, `user_id`,
`car_type`, `mileage`, `model_id`) VALUES('...