Removing a model in rails (reverse of "rails g model Title...")

Colbern picture Colbern · Aug 18, 2011 · Viewed 116.4k times · Source
rails g model Rating user_id:integer message:string value:integer

How can I completely remove this model? Thanks

Answer

Mikhail Nikalyukin picture Mikhail Nikalyukin · Aug 18, 2011
bundle exec rake db:rollback    
rails destroy model <model_name>

When you generate a model, it creates a database migration. If you run 'destroy' on that model, it will delete the migration file, but not the database table. So before run

bundle exec rake db:rollback