Skip to content

Instantly share code, notes, and snippets.

View stevecrozz's full-sized avatar

Stephen Crosby stevecrozz

View GitHub Profile
@stevecrozz
stevecrozz / object.rb
Last active December 14, 2015 02:39
RuntimeError: can't modify frozen hash In every one of these cases I've tracked down in the past, the error was in freezing an object that should not have been frozen. The backtrace telling you where the modification was attempted is often unhelpful. A snippet like this can help in a pinch to track down who froze your object.
class Object
attr_accessor :last_frozen_by
def freeze
@last_frozen_by = caller
super
end
end