The issue is not that it doesn't respond to #respond_to?. The issue is that @instance is not always defined, which generates a warning. Hence the addition of 'if defined?(@instance)'.