-1

I creating an app that needs to be able to create and drop tables on the fly, on create it's pretty simple I use: rails g model User name:string but there is no generator for dropping a table.

I want to make it be possible to: rails g migration DropTableUser

Cœur
  • 37,241
  • 25
  • 195
  • 267
itay ariely
  • 11
  • 1
  • 2

1 Answers1

0

To correct your question, rails g migration User name:string would result in a migration called User not a model, I guess what you meant was rails g model User name:string.

To answer your question, I think it would result in an unnecessary mental effort, especially since something like this already exists in:

rails [d|destroy] model User

If you want to still implement yours, I'd advise that you look at Rails Generators instead for a way to help you out. I guess that would be dependent on creating a migration template etc.

oreoluwa
  • 5,553
  • 2
  • 20
  • 27