I have a variable number of tables with variable number of rows and I want to have them displaying one after the other but if a table doesn\'t fit on the current page put it on
I'm a Prawn beginner, so this might not be the best solution, but it should work.
You can get the table height if you consider the font size and vertical padding and the number of records you have in @data
and you can get the current cursor position by calling Prawn::Document.cursor
method.
Having these two numbers you should be able to check whether the table fits on this page or not. If not, just start a new one (by calling Prawn::Document.start_new_page
method).
Otherwise the table will break automatically and will continue on the next page.