Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'csv'
- file = "#{Rails.root}/public/data.csv"
- schools = School.where(state_code: 'CO').order('name ASC')
- CSV.open( file, 'w' ) do |writer|
- schools.each do |s|
- writer << [s.name, s.zipcode, s.id]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement