Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Last active December 21, 2015 16:29
Show Gist options
  • Select an option

  • Save kmdsbng/6334049 to your computer and use it in GitHub Desktop.

Select an option

Save kmdsbng/6334049 to your computer and use it in GitHub Desktop.
generate csv background
def check_list
file = Tempfile.new("scl")
temp_siwake = ::TempSiwake.find(params[:id])
output_csv_file_path = "fname.csv"
pid = Process.fork {
@rows = load_rows(params[:id])
CSV.open(file.path, "w+") {|csv|
@rows.each_with_index {|row, i|
csv << row.fields_for_check
}
}
}
Process.waitpid(pid)
send_csv file, output_csv_file_path, :ignore_iconv_error => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment