Skip to content

Instantly share code, notes, and snippets.

@milushov
Created February 4, 2015 02:05
Show Gist options
  • Save milushov/3414c547db23b6d038b6 to your computer and use it in GitHub Desktop.
Save milushov/3414c547db23b6d038b6 to your computer and use it in GitHub Desktop.
time = Time.parse('Tue, 03 Feb 2015 22:32:11 MSK +03:00')
_begin = time.beginning_of_day
_end = time.end_of_day
target = '/tmp/5k_promos_3_4_2015.txt'
File.open(target, "w+") do |f|
Promocode.where(['generated_at >= ?', _begin]).where(['generated_at <= ?', _end]).each do |promo|
f.puts(promo.code)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment