Paperzip

This gem adds a method called paperzip() in your controllers

paperzip( paperclip_attachments= [], zip_file_name= 'file', zip_style= :original )

It accepts an array of paperclip attachments, a custom name for your .zip and a style for the attachments you want to zip.

Installing

In your environment.rb, add the following

config.gem 'ovelar-paperzip', :source => 'http://gems.github.com'

Example usage

In your controller you can do something like this:

def zip
  @collection = Collection.find(params[:id])
  paperzip(@collection.images.collect(&:data), @collection.name)
end

Dependencies

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2009 Lars O. Overskeid. See LICENSE for details.