DEV Community 👩‍💻👨‍💻


Posted on

Easy way to create tables in database

rails db:rollback in the terminal drops the most recent table in database.

Discard changes in Git.Then type rails generate draft:resource movie title:string description:text director_id:integer

this line in the terminal creates the routes for you, as well as the specific controller and in views as well!

At the end of that, ensure that you type rails db:migrate in the terminal so that is can be properly placed. If not then an error message saying "Migrations pending" will appear.

Top comments (0)

We are hiring! Do you want to be our Senior Platform Engineer? We're hiring for a Senior Platform Engineer and would love for you to apply.

Head here to learn more about who we're looking for.