---
title: "how to truncate table in rails"
author: "夜鸣猪"
date: "2013-01-29T04:14:58Z"
tags: []
categories: ["编程语言"]
slug: "how-to-truncate-table-in-rails"
draft: false
lastmod: "2013-01-29T04:14:58Z"
id: 1777130
url: "https://hlee.iteye.com/blog/1777130"
---

```ruby

ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table_name}")

```