DEV Community

Zipporah
Zipporah

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.

Latest comments (0)