Skip to content

Instantly share code, notes, and snippets.

@mculp
Created August 7, 2012 03:04
Show Gist options
  • Select an option

  • Save mculp/3280963 to your computer and use it in GitHub Desktop.

Select an option

Save mculp/3280963 to your computer and use it in GitHub Desktop.
def show
begin
month = Date.parse(params[:month])
rescue
flash[:error] = 'Invalid date.'
redirect_to admin_reports_path and return
end
@auctions = Auction.completed.where("updated_at > ? and updated_at <= ?", month, month.end_of_month)
@headers = [
"ID", "Nonprofit", "Payee Name", "Nonprofit Phone", "Nonprofit address 1", "Nonprofit address 2", "Nonprofit City",
"Nonprofit State", "Nonprofit ZIP", "Auction City", "Auction State", "Auction Zip", "Auction Name", "Amount ($)"
]
respond_to do |format|
format.xls { send_data render_to_string('report') }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment