htmlをhamlしているのですが、renderの箇所でテーマのエラーが発生しました。
show.html.haml
- provide(:title, @user.nickname) .jumbotron.jumbotron-extend .container.jumbotron-container .row %aside.col-md-4 %section.user_info %h3 = gravatar_for @user = @user.nickname %section.stats = render 'shared/stats' .col-md-8 = render 'follow_form' - if @user.microposts.any? %h3 Microposts (#{@user.microposts.count}) %ol.microposts = render @microposts = will_paginate @microposts
= render @micropostsの箇所でのエラーとなっています。
こちらのrenderは以下を見に行っています。
micropost/_micropost.html.haml
:erb <li id="micropost-<%= micropost.id %>"> :haml = link_to gravatar_for(micropost.user, size: 50), micropost.user %span.user= link_to micropost.user.nickname, micropost.user %span.content = micropost.content = image_tag micropost.picture.url if micropost.picture? %span.timestamp Posted #{time_ago_in_words(micropost.created_at)} - if current_user?(micropost.user) = link_to "削除する", micropost, method: :delete, data: { confirm: "削除してもいいですか?"} = render 'likes/like', micropost: micropost
そもそも論で調べてもscanがないということが理解できていません。micropostはDBにちゃんとあります。もし、お分かりになる方がいらっしゃいましたら教えて頂ければと思います。
nil参照系のエラーは、スタックトレースも貼らないと特定は難しいかと思います。
回答1件
あなたの回答
tips
プレビュー