Pagination undefined method `total_pages'

<% for @sites in @sites %>
<%= @sites.naam %>
<%= will_paginate @sites %>
<% end %>

that's going to balls everything up: initially @sites is a
will_paginate collection, but then you're overwriting it with a single
element from that collection. Also do you really want to be rendering
the pagination links for each elements. Typically you would do
someting like
for sites in @sites ... (or use a partial, or @sites.each do |
site> ...)

Fred

I wrote it exactly as in the railscasts

http://railscasts.com/episodes/51

and the official manual

http://rock.errtheblog.com/will_paginate

even the require 'will_paginate' i did
Only without any result

But are you using "for @sites in @sites" or not?

BTW, just in case, total_pages was recently added, it was called
page_count before.

Xavier Noria wrote:

But are you using "for @sites in @sites" or not?

BTW, just in case, total_pages was recently added, it was called
page_count before.

Yes i'am using @sites for @sites

when i'am using something different i got the same issue

How can i fix total_pages the error contains into the gem

Xavier Noria wrote:
> But are you using "for @sites in @sites" or not?

> BTW, just in case, total_pages was recently added, it was called
> page_count before.

Yes i'am using @sites for @sites

when i'am using something different i got the same issue

You're not using it as in the examples. THe examples all go
for site in @sites
#do something with site
end

will_paginate @sites

The way you do it can't work because you are reassigning one of the
sites to @sites, but will_paginate wants you to pass a collection, not
an individual element.

Fred

BEtter use paginate_find and faster pagination in rails using the
below link
http://www.igvita.com/2006/09/10/faster-pagination-in-rails/

Its better and effective.