Browse files

Create blog posts table

We fix the model test error by creating the `blog_posts` table.

Inner green; outer red: undefined method `title' for #<BlogPost id: nil>

Now the `BlogPost` can be instantiated, so the model test passes. We step back up to the acceptance test level and rerun it, and it's gotten past that error.

The next acceptance test error occurs when Rails attempts to render the form. The form helper tries to get the current value of the `title` field on the model, but there is no `title` method to retrieve it. Since we want `title` to be a database-persisted field on our model, the problem is that there is no `title` column in our database table.
  • Loading branch information...
CodingItWrong committed Jun 14, 2016
1 parent 2dbc3e6 commit 0301d014e5a06d42a5bcad57c335247646c38c31
Showing with 10 additions and 2 deletions.
  1. +6 −0 db/migrate/20180110120127_create_blog_posts.rb
  2. +4 −2 db/schema.rb
@@ -0,0 +1,6 @@
class CreateBlogPosts < ActiveRecord::Migration[5.1]
def change
create_table :blog_posts do |t|
@@ -1,4 +1,3 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@@ -11,9 +10,12 @@
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 0) do
ActiveRecord::Schema.define(version: 20180110120127) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "blog_posts", force: :cascade do |t|

0 comments on commit 0301d01

Please sign in to comment.