From the course: Ruby on Rails 5 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Solution: Migrations for the CMS

Solution: Migrations for the CMS - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

Solution: Migrations for the CMS

- In this movie I'm gonna show you, my solution, to the challenge assignment. This code is also included in the exercise files. The first thing I did was I went to my command line, Made sure I was in the root of my rails project. And then, I ran the command, rails generate model, subject. I used uppercase S, cause it's camel case, and I made it singular. Then it generated the model for me which created a migration and a model file as well. Then I ran rails generate model page... And did the same thing rails generate model section. So that gave me the three migration files that I needed with my models. Next, I came over to my text editor and I found those migrations in the db migrate folder. The first one was create subjects, and I changed the change method that it gave me by default to be two methods up and down. One that will create table subjects and the other that will drop table subjects. Inside table subjects I've given it a definition I've got a column string name, a column for…

Contents