Skip to content

Instantly share code, notes, and snippets.

@graysky
Created November 18, 2008 18:12
Show Gist options
  • Save graysky/26199 to your computer and use it in GitHub Desktop.
Save graysky/26199 to your computer and use it in GitHub Desktop.
# Note to self: Normally to turn off ActiveRecord timestamps you would set:
# ActiveRecord::Base.record_timestamps = false
# in the configuration. Timestamp.rb uses class_inheritable_accessor to copy that
# value for each AR model. So to change it at runtime (ex. tests) it needs to be
# accessed through the class directly.
myobj.class.record_timestamps = false
# Set timestamp manually to simulate old objects
myobj.updated_at = Time.now - 2.months.ago
myobj.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment