<%- # Based on Active Admin generator = RUBY_VERSION =~ /^1.8/ ? FasterCSV : CSV output = generator.generate do |csv| cols = @interface.attributes_for(:index) csv << cols.map{|col| col[:title]} @collection.each do |object| csv << cols.map do |col| if col[:data] instance_exec(object, &col[:data]) else pretty_format(object.send(col[:attribute])) end end end end %> <%= output.html_safe %>