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
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):
10: = submit_tag t(‘news.comment’), class: ‘btn btn-primary’
12: - unless @item.comments.any?
13: #comment-composer= t(‘news.no_comments’)
14: - else
15: - @comments.each do |comment|
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.