That is possible using either the zipline gem or its lower-level dependency, zip_kit
There is also a great article about it by Piotr Murach that you can find here
Source: I am the author of zip_kit and co-maintainer of zipline ;-)