ruby on rails - Why doesn't MyModel.all.each{|m| m.destroy} work as expected? -
I want to clear the table without leaving the database in my railway and migrating ...
MyModel.all.each {| M M.destroy}
I hope to remove every record in this code my_model table, but this is not happening ... using Rail 2.3.4 + MySQL 5.1. P>
Edit: This issue was based on the plugin better_nested_set which did not allow me to delete entries in that order
MyModel.delete_all
worked on the other side, Maybe because of this database (?)
use MyModel.destroy_all
Execute truncate on Confirms delete all records of your model.
Comments
Post a Comment