Skip to content

Instantly share code, notes, and snippets.

@duderman
Created June 6, 2016 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duderman/b5f79374a6647672c165a39fdb0513a1 to your computer and use it in GitHub Desktop.
Save duderman/b5f79374a6647672c165a39fdb0513a1 to your computer and use it in GitHub Desktop.
Rewinds old days to current period
d = Day.maximum(:date)
7.times { |i| Day.where(date: d - i.days).update_all(date: 7.days.from_now.to_date - i.days) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment