Class: ExportController

Inherits:
ArtfullyOseController show all
Defined in:
app/controllers/export_controller.rb

Instance Method Summary collapse

Instance Method Details

#contactsObject



3
4
5
6
7
8
# File 'app/controllers/export_controller.rb', line 3

def contacts
  @organization = current_user.current_organization
  @filename = "Artfully-People-Export-#{DateTime.now.strftime("%m-%d-%y")}.csv"
  @csv_string = @organization.people.includes(:tags, :phones, :address).all.to_comma
  send_data @csv_string, :filename => @filename, :type => "text/csv", :disposition => "attachment"
end

#donationsObject

Artful.ly generates these nightly and provides links directly to s3



13
14
15
16
17
18
19
# File 'app/controllers/export_controller.rb', line 13

def donations
  @organization = current_user.current_organization
  @filename = "Artfully-Donations-Export-#{DateTime.now.strftime("%m-%d-%y")}.csv"
  @items = ItemView.where(:organization_id => current_organization).where(:product_type => "Donation").all
  @csv_string = @items.to_comma(:donation)  
  send_data @csv_string, :filename => @filename, :type => "text/csv", :disposition => "attachment"
end

#ticket_salesObject

Artful.ly generates these nightly and provides links directly to s3



24
25
26
27
28
29
30
# File 'app/controllers/export_controller.rb', line 24

def ticket_sales
  @organization = current_user.current_organization
  @filename = "Artfully-Ticket-Sales-Export-#{DateTime.now.strftime("%m-%d-%y")}.csv"
  @items = ItemView.where(:organization_id => current_organization).where(:product_type => "Ticket").all
  @csv_string = @items.to_comma(:ticket_sale)    
  send_data @csv_string, :filename => @filename, :type => "text/csv", :disposition => "attachment"
end