NoMethodError in Shelf#show

Showing /app/app/views/shelf/_imagetext.html.erb where line #4 raised:

undefined method `imageurl' for nil:NilClass
Extracted source (around line #4):
2
3
4
5
6
7
              
<% book = entry.book %>
<% shelf = entry.shelf %>
<% imageurl = book.imageurl %>
<% if imageurl.to_s == '' then %>
<div class='book_noimage'>
<%= link_to book.title, url_for(:controller => 'shelf', :shelfname => shelf.name, :isbn => book.isbn, :action => 'edit'),

Trace of template inclusion: app/views/shelf/_detaillist.html.erb, app/views/shelf/show.html.erb

Rails.root: /app

Application Trace | Framework Trace | Full Trace

Request

Parameters:

{"shelfname"=>"LILY"}

Response

Headers:

None