class DebugController < ActionController::Base def render_foo(argv = nil) @foo = 'Foo' render_to_string template: 'foos/show' end end DebugController.new.render_foo => "<!DOCTYPE html>\n<html lang='ja'>\n<head>\n<meta charset='UTF-8'>\n<title>Foo</title>\n</meta>\n</head>\n<body>\n<h1>Foo</h1>\n</body>\n</html>\n" ac = ApplicationController.new ac.instance_variable_set(:@foo, 'Foo') # インスタンス変数をインジ