I’m running a rake task to destroy all of my “course” objects:
task :destroy_all_classes => :environment do
Course.all.each do |c|
c.destroy
end
end
This destroys most of the courses, but 12 remain (out of 40+). What might be preventing me from deleting them?
If I try deleting each course manually, through the console, I get this:
ruby-1.9.2-p290 :030 > Course.find(1).destroy
=> false
Enable cascade destroy.
Course have at lest one “has many”or “has one” relation with another model.Something like
make it
You can also use
Best of luck !!!