Undefined method `name' for nil:NilClass

Hi, i’m pretty new to the Rail and Ruby and today I have a problem that
I
have to solve (tl;dr: the expert ruby/rails has left our company and now
the newbies like me have to work on the projects that he left). So,
let’s
go straight:

I have an app running “normally”, login function OK, but then when the
user
try to reach other sections on the site like this one in the error
bellow:

Processing by NewsController#show as HTML
Parameters: {“id”=>“news-alpha-2-3-8”}
Rendered application/_pagetitle.html.haml (0.1ms)
Rendered application/_pagetitle.html.haml (0.0ms)
Rendered news/show.html.haml within layouts/application (2.5ms)
Completed 500 Internal Server Error in 19ms

ActionView::Template::Error (undefined method name' for nil:NilClass): 9: .pull-right 10: = submit_tag t('news.comment'), class: 'btn btn-primary' 11: .clearfix 12: - unless @item.comments.any? 13: #comment-composer= t('news.no_comments') 14: - else 15: - @comments.each do |comment| app/views/news/show.html.haml:12:in_app_views_news_show_html_haml___3582658555150926440_64556152601540’

And the “undefined method `name’ for nil:NilClass” error appears in
other
sections as well. If nay of you could explain me why this erros shows
up,
because i’ve double checked the database and these fields are ok, do I
have
to check for more specific errors? Thanks in advance.

On 29 June 2015 at 18:54, William de Lima [email protected]
wrote:

`_app_views_news_show_html_haml___3582658555150926440_64556152601540’
Is @item nil possibly?

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs