Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save catogonzalez/8e9221ef302ebef84710ea4412f3ecde to your computer and use it in GitHub Desktop.
Save catogonzalez/8e9221ef302ebef84710ea4412f3ecde to your computer and use it in GitHub Desktop.
Using active support time helpers to change the current date in the rails console
require 'active_support/testing/time_helpers'
# the class below could have any name
class Tempo
include ActiveSupport::Testing::TimeHelpers
end
# any desidered date
desired_date = Date.today - 2.days
Tempo.new.travel_to desired_date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment