Browse files

Add fields and submit button to form template

This is another case where all we needed to add to get the test to pass was the title field. But this is a reasonable case where you know what the form will consist of, so you can go ahead and create it all. Plus, your tests will never drive out the full markup of your templates, so you'll need to do that by hand anyway.

Red: First argument in form cannot contain nil or be empty

<%= form_for @blog_post do |f| %>

In other words, @blog_post is nil but needs to be a model.
  • Loading branch information...
CodingItWrong committed Feb 26, 2016
1 parent 48b6da6 commit 7144bb1974d136762e16f0b398a1a3eb2902e0ba
Showing with 11 additions and 1 deletion.
  1. +11 −1 app/views/blog_posts/new.html.erb
@@ -1 +1,11 @@
<%# empty view %>
<%= form_for @blog_post do |f| %>
<%= f.label :title %>
<%= f.text_field :title %>
<%= f.label :body %>
<%= f.text_area :body %>
<%= f.submit 'Create Blog Post' %>
<% end %>

0 comments on commit 7144bb1

Please sign in to comment.