Skip to content

Instantly share code, notes, and snippets.

@zilkey
Created February 15, 2009 18:48
Show Gist options
  • Save zilkey/64806 to your computer and use it in GitHub Desktop.
Save zilkey/64806 to your computer and use it in GitHub Desktop.
class Views::Layouts::Application < Erector::Widget
def render
div :class => "header" do
text "header"
end
div :class => "body" do
inner_content
end
div :class => "footer" do
text "footer"
end
end
end
class Views::Projects::Index < Views::Layouts::Application
def inner_content
text "inner content "
end
end
# this will work
class ProjectsController < ApplicationController
def index
render_widget(Views::Projects::Index)
end
end
# this will not work - throwing error
#
# undefined local variable or method `inner_content' for #<Views::Layouts::Application:0x3ad6f6c>
#
class ProjectsController < ApplicationController
def index
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment