NoMethodError in Photos#bpod_photo

Showing /home/photobazaar/public_html/app/views/photos/_photo_detail.html.erb where line #53 raised:

undefined method `code' for nil:NilClass

Extracted source (around line #53):

50
51
52
53
54
55
56
          
</div>
<div class="column">
<div class="ui inverted list">
<div class="item"><label>Рубрика:</label> <a href="<%=categories_path @photo.category.code %>"><%=@photo.category.name_l18n %></a></div>
<div class="item"><label>Опубликовано:</label> <span class="time" created-at="<%= @photo.created_at %>"><%= @photo.created_at %></span></div>
<div class="item license"><label>Лицензия:</label><%==show_photo_license @photo.license_type %></div>
<div class="item copyright">Фотография предоставлена сервисом 500px.com</div>

Trace of template inclusion: app/views/photos/bpod_photo.html.erb

Rails.root: /home/photobazaar/public_html

Application Trace | Framework Trace | Full Trace
app/views/photos/_photo_detail.html.erb:53:in `_app_views_photos__photo_detail_html_erb__298399109036262941_55898600'
app/views/photos/bpod_photo.html.erb:28:in `block in _app_views_photos_bpod_photo_html_erb___3512580453998869205_38091440'
app/views/photos/bpod_photo.html.erb:24:in `_app_views_photos_bpod_photo_html_erb___3512580453998869205_38091440'

Request

Parameters:

{"id"=>"18236"}

Response

Headers:

None