Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Convenience method to truncate a table using ActiveRecord

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 GPL-LICENSE
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 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.