Skip to content

Instantly share code, notes, and snippets.

@RSpace
Created July 9, 2010 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RSpace/469303 to your computer and use it in GitHub Desktop.
Save RSpace/469303 to your computer and use it in GitHub Desktop.
Mime::Type.register "application/vnd.ms-excel", :xls
ActionController::Renderers.add :xls do |object, options|
instance = object.respond_to?(:first) ? object.first : object
options = instance.respond_to?(:xls_options) ? instance.xls_options : {}
self.send_data object.to_xls_data(options), :type => :xls
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment