Hi there, I’ve recently upgraded to 1.1.6 and noticed this has started
happening. It’s a standard list page:
Controller:
def list
@artwork_pages = Paginator.new self, Artwork.count, 10,
@params[‘page’]
@artworks = Artwork.find :all,
:conditions => [ “artist_id = ?”,
params[:artist] ],
:limit => @artwork_pages.items_per_page,
:offset => @artwork_pages.current.offset
@artist = Artist.find(params[:artist])
end
View:
Artworks
<%= link_to 'Back to Artist', :controller => '/admin/artist', :action => 'show', :id => params[:artist] %> | <%= link_to 'Manage Categories', :controller => '/admin/category', :action => 'list', :artist => @artist %>
Below are the artworks that belong to <%= h @artist.name %>. From here you can create a new artwork and work with existing artworks. Once you have created <%= link_to 'Categories', :controller => '/admin/category', :action => 'list', :artist => @artist %> you can begin adding artworks to them by going to the <%= link_to 'Categories', :controller => '/admin/category', :action => 'list', :artist => @artist %> section and clicking on the category's name.
<%= link_to 'Create a New Artwork', :action => 'new' %>
<% if @artworks.empty? %>There are currently no Artworks...
<% else %><%= link_to (h artwork.name), :action => 'show', :id => artwork %> | $<%=h "%.2f" % artwork.price %> | <% if artwork.sale_status == true %>Yes<% else %>No<% end %> | <%= link_to 'Edit', :action => 'edit', :id => artwork %> | <%= link_to 'Destroy', :action => 'confirm', :id => artwork %> |
<%= link_to 'Previous page', { :page => @artwork_pages.current.previous } if @artwork_pages.current.previous %> <%= link_to 'Next page', { :page => @artwork_pages.current.next } if @artwork_pages.current.next %>
Now the problem is that even though there aren’t 10 artworks, the ‘Next
page’ shows up anyway. I’ve compared this CV set to another CV set that
basically does exactly the same thing except with categories, and it
doesn’t have the same problem. Even in the logs, everything is exactly
the same. It’s as if @artwork_pages.current.next is falsely triggering?
There are more than 10 artworks over ALL artists, perhaps it’s
triggering because of that. Is that an error in my code then that’s
counting all artworks instead of only this artists artworks, or is it a
bug?
Cheers,
Brendon