[Rails] Re: NameError?
you loop through all @posts, but your object is called "status" - change "status" to "post" and everything will work..
Am Donnerstag, 18. Oktober 2012 16:38:03 UTC+2 schrieb wragen22:
Hi all,--I've created an app that has posts with string "title" and text "content".I'm getting the following error when adding this loop. Any idea?NameError in Posts#index
Showing /Users/bradwrage/
webapps/blog/app/views/posts/ where line #7 raised:index.html.erb undefined local variable or method `post' for #<#<Class:0x10bf2d620>:
0x10c058798> Extracted source (around line #7):
4: 5: <% @posts.each do |status| %> 6: <div class="post"> 7: <strong><%= post.title %></strong> 8: </div> 9: 10: <% end %>
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vaEb1SQg7aIJ.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home