clean all records

hi @ all How can I clean all records from a table in a mysql database without delete the table in the database? (only use a method in the model)

thanks for helping!

Take a look at destroy_all

http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001384

Aaron

Actually, delete_all might be a better bet in this case because it runs without instantiating the records first.

Aaron

Is this for your development environment and are you using test fixtures? If so you can easily load test fixtures into your development database by running "rake db:fixtures:load".

Aaron

Aaron wrote:

Is this for your development environment and are you using test fixtures?

No, but I want to copy / overwrite an existing table with rake in the same environment. Is it possible with rake? Or with an other solution?

For example: I have a table people and I want to copy this table into the guests table.