Skip to content

Commit b5801e0

Browse files
committed
Steps 1 & 2 of Schneems' UT-Rails course
1 parent c31e16a commit b5801e0

4 files changed

Lines changed: 41 additions & 4 deletions

File tree

erb_example.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
require 'erb'
22

3+
firstname = "Kyle"
4+
lastname = "Gracey"
35
x = 42
46
template = ERB.new "The value of x is: <%= x %>"
5-
puts template.result(binding)
7+
puts template.result(binding)
8+
9+
myname = ERB.new "My name is <%= firstname %> <%= lastname %>"
10+
puts myname.result(binding)

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1> Hello</h1>
22
<p>
33
The time is now:
4-
2012-06-16 16:00:08 -0500
4+
2013-04-13 14:06:39 -0500
55
</p>
66

77
<p>

public/me.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
foo
1+
2+
3+
<div class="header">
4+
<h2>This is the 'Me' page. </h2>
5+
</div>
6+
<div>
7+
<p>My name is Kyle Gracey. I like:</p>
8+
<ul>
9+
10+
<li>Motorcycles</li>
11+
12+
<li>Hockey</li>
13+
14+
<li>Cooking</li>
15+
16+
</ul>
17+
</div>

views/me.html.erb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
foo
1+
<%
2+
firstname = "Kyle"
3+
lastname = "Gracey"
4+
things = ['Motorcycles', 'Hockey', 'Cooking']
5+
%>
6+
7+
<div class="header">
8+
<h2>This is the 'Me' page. </h2>
9+
</div>
10+
<div>
11+
<p>My name is <%= firstname %> <%= lastname %>. I like:</p>
12+
<ul>
13+
<% things.each do |thing| %>
14+
<li><%= thing %></li>
15+
<% end %>
16+
</ul>
17+
</div>

0 commit comments

Comments
 (0)