I'm having a problem with will_paginate
that's pretty simple to express:
> Story.paginate(page: 1, per_page: 10).count
=> 20
Obviously, that number should be 10, not 20.
Am I somehow doing something wrong? Doesn't seem like there's much room for error here, but obviously something isn't right. What am I missing?
You want Story.paginate(page: 1, per_page:10).size
, not count
. Count will actually return the total numbers of records generated by your query.