I have a big horrible query that is built in lots of terrible steps (The problems with working with legacy databases.) which I would like to add pagination to. I had hoped to sidestep writing a custom result (I can't figure out how to get the total without executing a separate query).
I had hoped to use Sequels inbuild pagination to do this or [the will_paginate gem](but I can't seem to get either to work, can it be used on general queries of the form
I have tried both:
DB["select some really long ugly sql"].pagination_record_count
and
DB["select some really long ugly sql"].paginate(1, 10)
with
require 'sequel/extensions/pagination'
DB.extension(:pagination)
from here for the first example. and
require 'will_paginate'
require 'will_paginate/active_record'
along with trying
require 'will_paginate/collection'
require 'will_paginate/version'
require 'sequel/extensions/pagination'
None of these seem to work, will it just not work for normal sequel queries? Is there something I'm missing?
Does anyone have any other advice on implementing pagination (like how to get things to happen in one request?)
Thanks in advance.