I have installed the last version of will_paginate, and I am trying to use it at my view like this:
@courses = Course.paginate(:page => params[:page])
will_paginate @courses
but, I get nothing in the view! any idea ??
the following conditions are met:
>> defined? WillPaginate
>> ActiveRecord::Base.respond_to? :paginate
is there something I am missing ??
will_paginate will render the links only if items number greater than items per page, in my case, I have only 5 items, also, will_paginate will not render items, it just renders the pagination links.
You have to render the results, the snippet they showed in the documentation is only for showing the HTML for the breadcrumb. The documentation expected us to know that we still render the object. The only difference is the line in the controller scopes the object to the segmented current page. Hence the :page = url params page.
CONTROLLER:
@courses = Course.paginate(:page => params[:page])
VIEW:
<%= render @courses %>
<%= will_paginate @courses %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With