Created
October 6, 2014 21:45
-
-
Save glinesbdev/dcafa7ce20c70214147d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def export_orders | |
authorize! :export_orders, @project | |
file_name = I18n.transliterate("#{@project.title}_supporters").downcase.gsub(/\s/, '_').gsub(/[^a-z_]/, '') | |
file_name = file_name.present? ? file_name : 'unknown' | |
if current_platform.id == 263 | |
csv_pledges = "Name,Email,Adresse,Adresszeile 2,Stadt,Bundesland,PLZ,Land,Beitrag,Projekttitel,Beitragszeit,Kosten des Tauschguts,Tauschgut,Beschreibung,Tauschgut,Versanddatum,\r\n" | |
else | |
csv_pledges = "Name,Email,Address,Address Line 2,City,State,Zip Code,Country,Amount,Project Title,Timestamp,Reward Level,Reward Description,Reward Delivery Date\r\n" | |
end | |
@project.pledges.confirmed.map{|p| csv_pledges += p.to_csv_with_reward_details} | |
send_data csv_pledges, filename: "#{file_name}.csv", type: 'text/csv; charset=utf-8; header=present' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment