To break up a long migration of data, I'm using a query limited to groups of 100, then processing those 100 records.
something like this...
count = Model.where("conditions").count
count = count / 100
count = count+1 if count%100 != 0
count.times do
#do my data migration steps .limit(100)...
end
is there a shortcut or better way of doing that count based on whether or not there is a remainder when dividing by 100? Feels like I'm forgetting an easy way (besides rounding which seems slower, but maybe it's not).