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:
<h1>Artworks</h1>
<p><%= link_to ''Back to Artist'', :controller =>
''/admin/artist'', :action
=> ''show'', :id => params[:artist] %>
| <%= link_to ''Manage Categories'', :controller =>
''/admin/category'',
:action => ''list'', :artist => @artist %>
</p>
<p>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.</p>
<p><%= link_to ''Create a New Artwork'', :action =>
''new'' %></p>
<% if @artworks.empty? %>
<p class="empty-table">There are currently no
Artworks...</p>
<% else %>
<table class="dblisting">
<tr>
<th>Name</th>
<th>Price</th>
<th>Sold?</th>
<th colspan="2">Options</th>
</tr>
<% for artwork in @artworks %>
<tr>
<td><%= link_to (h artwork.name), :action =>
''show'', :id => artwork
%></td>
<td>$<%=h "%.2f" % artwork.price %></td>
<td><% if artwork.sale_status == true %>Yes<% else
%>No<% end
%></td>
<td class="options"><%= link_to ''Edit'',
:action => ''edit'', :id =>
artwork %></td>
<td class="options"><%= link_to
''Destroy'', :action => ''confirm'', :id
=> artwork %></td>
</tr>
<% end %>
</table>
<% end %>
<p class="pagination">
<%= 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 %>
</p>
------------
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---