title: how to clear whole database in Rails seeds.rb
body: <p>What is the best way to accomplish this? As for now I'm using:</p>
  
  <pre><code>Role.delete_all
  User.delete_all
  ...
  </code></pre>
  
  <p>but how to clear habtm talbes? Like roles_users</p>
  
  <h2>Updated Answer</h2>
  
  <p>I think ream88 response answers my question most precisely, but probably the bestidea is to follow coreyward suggestion to use separate rake tasks and leave seeds.rb only for seeding data.</p>
  
  <p>This is updated answer from ream88 which doesn't delete <code>schema_migrations</code> table.</p>
  
  <pre><code>ActiveRecord::Base.establish_connection
  ActiveRecord::Base.connection.tables.each do |table|
    # MySQL
    ActiveRecord::Base.connection.execute("TRUNCATE #{table}") unless table == "schema_migrations"
  
    # SQLite
    # ActiveRecord::Base.connection.execute("DELETE FROM #{table}") unless table == "schema_migrations"
  end
  </code></pre>
  
  <p>Thanks a lot for help!</p>