NoMethodError in Shelf#edit

Showing /app/app/views/shelf/edit.html.erb where line #105 raised:

undefined method `categories' for nil:NilClass
Extracted source (around line #105):
103
104
105
106
107
108
              
<td valign="top">カテゴリ</td>
<td valign="top">
<% entry.categories.to_s.split(/,\s*/).each { |category| %>
<%= link_to category, :action => 'category_detail', :category => category %>
<% } %>
</td>

Rails.root: /app

Application Trace | Framework Trace | Full Trace

Request

Parameters:

{"shelfname"=>"LED", "isbn"=>"4833417413"}

Response

Headers:

None