在Ruby中,我该怎么做:
number_total = records / per_page
Run Code Online (Sandbox Code Playgroud)
where per_page = 100,and records = 1050,然后向上舍入所以没有小数?那么,而不是10.5,它等于11?
saw*_*awa 28
编辑后发表评论
number_total = (records / per_page.to_f).ceil
Run Code Online (Sandbox Code Playgroud)