Sha256: 1b11c491c74896748513ef7231946026f3c5fad885db6e959d9fd4244426eaa5

Contents?: true

Size: 433 Bytes

Versions: 1

Compression:

Stored size: 433 Bytes

Contents

require 'activesupport'

if defined?(ActionController)

  ActionController::Base.class_eval do
    def render_with_csv(options = nil, extra_options = {}, &block)
      return render_without_csv(options, extra_options, &block) unless (options.respond_to? '[]') and options[:csv]
      data = options.delete(:csv)
      send_data Array(data).to_csv, options.merge(:type => :csv)
    end
    alias_method_chain :render, :csv
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danielvlopes-smart_csv-0.1.0 lib/smart_csv/render.rb