---
title: "rails里使用truncate table"
author: "夜鸣猪"
date: "2012-09-07T02:04:57Z"
tags: []
categories: ["编程语言"]
slug: "rails-truncate-table"
draft: false
lastmod: "2012-09-07T02:04:57Z"
id: 1673199
url: "https://hlee.iteye.com/blog/1673199"
---

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

```