Browse files

Add blog post model

We add the BlogPost model class. Although we don't strictly need to subclass `ApplicationRecord` to get the acceptance test error to pass, we're sure enough that this will be an Active Record model that it's safe for us to go ahead and subclass it.

Note that we will soon step down from our acceptance test to create a model test, but we don't do it just yet. We write model tests and other lower-level tests to specify behavior, but we haven't reached a behavioral error yet. This is just a structural error: there is no `BlogPost` class. That's simple enough that we can just implement it directly.

Red: PG::UndefinedTable: ERROR:  relation "blog_posts" does not exist

Because we subclass `ApplicationRecord`, our call to `` checks for the existence of a `blog_posts` table (a "relation"), and doesn't find one.
  • Loading branch information...
CodingItWrong committed Jun 14, 2016
1 parent 6eb92b2 commit 259c646650e79f95d3ea16535d71f0999d309df3
Showing with 2 additions and 0 deletions.
  1. +2 −0 app/models/blog_post.rb
@@ -0,0 +1,2 @@
class BlogPost < ApplicationRecord

0 comments on commit 259c646

Please sign in to comment.