Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polyglotdev/ce9c0d25df5d3bc84a428dad1f8c2b4d to your computer and use it in GitHub Desktop.
Save polyglotdev/ce9c0d25df5d3bc84a428dad1f8c2b4d to your computer and use it in GitHub Desktop.
Drop Table, Model, Migration in Rails

Dropping Migration Table, Models, Controller

Command Line

1. Drop Table/Migration

rails generate migration DropTablename

A file will be created, in the db > migrate folder, make sure it looks like:

class DropUsers < ActiveRecord::Migration
  def change
    drop_table :users
  end
end

2. Drop Model

rails d model user

3. Drop Controller

rails d controller users

4. Re-Migrate

be rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment