Skip to content

Instantly share code, notes, and snippets.

@mark-d-holmberg
Created January 1, 2013 19:48
Show Gist options
  • Save mark-d-holmberg/4429575 to your computer and use it in GitHub Desktop.
Save mark-d-holmberg/4429575 to your computer and use it in GitHub Desktop.
Given a list of published articles, randomly distribute their published_at date to be between 5 months ago and today.
Article.published.each do |k|
new_published = rand(5.months.ago..Time.now)
k.update_attribute(:published_at, new_published)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment