zilkey (owner)

Revisions

gist: 64806 Download_button fork
public
Public Clone URL: git://gist.github.com/64806.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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