i have a problem that involve mysql. i habe two tables: groups,ranks
ranks have a foraign key from groups with delete on cascade.
In my ranks migration i use this
execute ‘ALTER TABLE ranks ADD FOREIGN KEY (group_id) REFERENCES groups
(id) ON DELETE CASCADE;’
if i do the following in the mysql console i get an empty result as
DELETE FROM groups WHERE id=3; SELECT * FROM ranks WHERE group_id=3;
BUT here comes the Problem:
returns several ranks!!
First when i add “sleep 3” between these commands it works
returns nil as expected
but thats not the solution i really want…
is it a rails bug or mysql problem?
Rank.find_by_group_id(3) should first be executed if the
delete-statement(with delete on cascade) is finished.
is this shitty behaviour a rails bug or what? can some one help me out