I am new to rails and want to figure out the syntax for truncating a
table using a rake file. Any ideas? thanks in advance!
Hi, what do you mean truncate a table? Do you mean delete the contents of the table or
delete the table?
-Conrad
I am new to rails and want to figure out the syntax for truncating a
table using a rake file. Any ideas? thanks in advance!
Hi, what do you mean truncate a table? Do you mean delete the contents of the table or
delete the table?
-Conrad
Conrad Taylor wrote:
If you make your task depend on the magic :environment task then activerecord will be loaded with your database configuration (and you models etc.) and you can just do MyModel.connection.execute "..." as you would have normally or just SomeModel.delete_all if you don't care about the difference between truncate and deleting all rows.
Fred