Skip to content

Instantly share code, notes, and snippets.

@spovich
Created August 10, 2011 22:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spovich/1138415 to your computer and use it in GitHub Desktop.
Save spovich/1138415 to your computer and use it in GitHub Desktop.
# Fix for Zippy template handler loading
# Make template handler compatible with Rails 3.0.x and 3.1+
# Original https://github.com/toretore/zippy/blob/master/rails/init.rb
require 'zippy'
Mime::Type.register 'application/zip', :zip
module ActionView
module Template::Handlers
class Zipper
def self.call(template)
new.compile(template)
end
def compile(template)
"Zippy.new { |zip| #{(template.respond_to?(:source) ? template.source : template)} }.data"
end
end
end
Template.register_template_handler :zipper, Template::Handlers::Zipper
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment