Skip to content

Commit

Permalink
Add blog post model
Browse files Browse the repository at this point in the history
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 `BlogPost.new` checks for the existence of a `blog_posts` table (a "relation"), and doesn't find one.
  • Loading branch information
Josh Justice committed Apr 9, 2018
1 parent 6eb92b2 commit 259c646
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/blog_post.rb
@@ -0,0 +1,2 @@
class BlogPost < ApplicationRecord
end

0 comments on commit 259c646

Please sign in to comment.