Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Convenience method to truncate a table using ActiveRecord
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
GPL-LICENSE
MIT-LICENSE
README
Rakefile
init.rb

README

TruncateTable
=============

Truncate your table with ActiveRecord::Base.truncate_table!

Works with mysql and sqlite (and others which support either TRUNCATE TABLE or DELETE FROM)

This plugin is especially useful for the 'down' method in a migration which populates a table after creation.


Example
=======

User.truncate_table! removes all users


Running Unit Tests
==================

You'll need mysql and sqlite3 installed, as per usual. Also, rspec.

Run the following to generate a template for mysql:

  cp spec/mysql_connection.yml.template spec/mysql_connection.yml

Customize spec/mysql_connection.yml.  You'll need to create the mysql database
given in that file.

Run specs:

    rake spec


Author
======

  Copyright (c) 2009
  Scott Taylor <scott@railsnewbie.com>

  Development sponsored by EastMedia (http://eastmedia.com/)


License
=======
  
  Dual licensed under the MIT and GPL3 licenses
Something went wrong with that request. Please try again.