Skip to content

Instantly share code, notes, and snippets.

@yangxing-star
Last active August 29, 2015 14:08
Show Gist options
  • Save yangxing-star/a24f4d40921cac170857 to your computer and use it in GitHub Desktop.
Save yangxing-star/a24f4d40921cac170857 to your computer and use it in GitHub Desktop.
require 'csv'
CSV.open('/home/ubuntu/simple_crm/data.csv', 'w' ) do |writer|
Customer.where('import_at > ?', '2014-10-19 00:00:00').each do |c|
writer << [ c.name, c.mobile, c.company, Customer::CAREERS.invert[c.career], c.province.try(:name), c.city.try(:name), c.market_name, c.address, c.scale ]
end
puts '完成'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment