Sha256: 7b7cac7b7e2beb35d30209b8ee211089fe9fa72febd320681a60a4255f62d761
Contents?: true
Size: 698 Bytes
Versions: 1
Compression:
Stored size: 698 Bytes
Contents
require 'csv_rails/array' require 'csv_rails/active_model' Array.send(:include, CsvRails::Array) if defined?(ActiveRecord) require 'csv_rails/active_record' ActiveRecord::Base.send(:include, CsvRails::ActiveRecord) end if defined?(Mongoid) require 'csv_rails/mongoid' Mongoid::Document.send(:include, CsvRails::Mongoid) end Mime::Type.register "text/tsv", :tsv [:csv, :tsv].each do |format| ActionController::Renderers.add format do |obj, options| filename = options[:filename] || File.basename(request.path) send_data obj.send("to_#{format}", options), :type => Mime.const_get(format.to_s.upcase), :disposition => "attachment; filename=#{filename}.#{format}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csv_rails-0.6.1 | lib/csv_rails.rb |