mysql error: can't destroy an object that is created using factoryGirl
问题 I was using mysql db to run rspec in rails. After I create an object using factoryGirl, I would like to destroy it so that the db looks clean for the next spec running. Here is how i set up in my spec: before (:each) do User.destroy_all @user = Factory.create :user end after (:each) do @user.destroy end I got an error running rspec: Failure/Error: @user.destroy_all NameError: uninitialized constant User::connection Failure/Error: @user.destroy NameError: uninitialized constant User: