Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Update last_activity_date with random times
def make_random_time
date1 =
date2 = - 50000000 # Beginning of time range - date1.to_f) * rand + date1.to_f).to_s
contacts = Contact.where(...)
contacts.each { |contact| contact.update_attribute(:last_activity_date, make_random_time) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment