On 25 March 2015 at 22:12, Med Potter <[email protected]> wrote: > I followed every line of the tutorial > > but I get this error > > Showing /home/ubuntu/blog/app/views/articles/index.html.erb where line #9 > raised: > undefined method `each' for nil:NilClass > > <% @articles.each do |article| %> > <tr> > <td><%= article.title %></td> > <td><%= article.text %></td> > > > > if you think that might not have returned the articles in the controller, > thats not true : > here is code for my controller : > > > $ cat app/controllers/articles_controller.rb > class ArticlesController < ApplicationController > def index > @articles = Article.all
To check that @articles is ok at this point then insert here puts @articles.inspect which will print the contents of @articles in the server terminal window. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvLyU02nrsmQUfy38V9cW0_yYQCgjTQ84%3DHDB-EsuCprg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

