Slide 109
Slide 109 text
app/controllers/hello_controller.rb
class SafariControllerViewContext < ActionView::Base
include Rails::AllTheHelpers
# link_to, etc.
include MyApp::AllTheHelpers
# current_user, etc.
def initialize(assigns)
assigns.each { |k, v| instance_variable_set("@#{k}", v) }
end
private
# Hey <%= current_user.name %>, meet
# <%= link_to @hippo.name, @hippo %>!
def __compiled_app_templates_hippo_erb
output = ""
output << "Hey "
output << html_escape(current_user.name)
output << ", meet"
output << link_to(html_escape(@hippo.name), @hippo)
output << "!"
output
end
end
NOTE: To see the actual code, look in ActionView!::Rendering, ActionView!::Base,
ActionView!::Renderer, ActionView!::TemplateRenderer, ActionView!::Template