Last active
December 29, 2023 10:01
-
-
Save tjvc/1bb3c4105a50ccdd7db0471d183d86bf to your computer and use it in GitHub Desktop.
true or false?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assume a Rails app with a User model. Assign a User instance to a | |
# variable, remove and reload the model class constant (simulating code | |
# reloading in development) and test equality of the cached instance and | |
# another of the same record. True or false? | |
cached_user = User.find(1) | |
Object.send(:remove_const, :User) | |
load 'app/models/user.rb' | |
cached_user == User.find(1) |
require_relative "config/environment"
cached_user = User.find(1)
Object.send(:remove_const, :User)
load 'app/models/user.rb'
p cached_user == User.find(1)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
true