Store Jobs In The Database
Goals
Discussion: Databases & SQL
Steps
Step 1: generate a jobs model and a jobs migration
Type this in the shell:rails g model jobStep 2: add columns to the migration
class CreateJobs < ActiveRecord::Migration[5.0] def change create_table :jobs do |t| t.timestamps end end endcreate_table :jobs do |t| t.string :title t.text :description t.timestamps endStep 3: create the table in the database
Type this in the shell:rails db:migrateDiscussion: Why do we use migrations?
Step 4: Check out the model
Now would be a good time to commit to git
Next Step:
Go on to Add A New Job Form