small medium large xlarge

15 Oct 2014, 21:10
Sean Ankenbruck (1 post)

Good afternoon,

I recently created the model and updated the line_items table using the exact text from the book.

rails g scaffold Order name address:text email pay_type

rails g migration add_order_to_line_item order:references

After doing some reading online I found another suggested method for adding this column to the line_item table.

rails g migration add_order_id_to_line_item order_id:integer

Feeling quite adventurous I decided it would be a good idea (in hindsight not so good of an idea) to run a rake:db rollback and go with the second method described above. Now my application has crashed. It seems that although I ran a rake:db rollback the Order table has already been created as well as all of the other files that go along with the Order model.

Two part question:

1) Which of the above described methods would be best to use and what is the difference?

2) How can I completely rid my application of the scaffold and migration so that I can start over fresh? StackOverflow has some great descriptions about how to delete the table and run the rollback but I couldn’t find many resources on how to get rid of all of the “stuff” rails created when I ran the scaffold and migration.

You must be logged in to comment