Step 10 NoMethodError


#1

I’m adding the form in task 11 of step 10, here’s my code

			<%= form_for(@new_post) do |f| %>  
			<div class="field"> 
				<%= f.label :comment %><br> 
				<%= f.text_field :comment %> 
    	</div> 
			<div class="actions"> 
				<%= f.submit "Create" %> 
			</div> 
			<% end %>

when I run the code i get

Showing /home/ccuser/workspace/learn-rails_threadly-2/threadly/app/views/posts/index.html.erb where line #14 raised:

undefined method `comment’ for #<Post id: nil, created_at: nil, updated_at: nil>
Did you mean? committed!

line 14 is the <% f.text_field :comment %>

I’ve looked at the database import and controller, and I haven’t been able to find the problem. Does anyone have any ideas?


#2

I found the problem, the db migration didn’t pick up the comment field, after fixing that this is working as it should.


#3