Skip to content

Commit a1060ea

Browse files
committed
added the link_to method in the applications.html.erb file
1 parent 8ff8e72 commit a1060ea

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

public/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
2+
13
<html>
24
<body>
35
<h1>You're using a layout</h1>
46
<p>
57
<h3> I'm a header</h3>
68
<p><ol>
7-
<li><a href="http://google.com">This is a link to google</a></li>
9+
<li><a href='http://yahoo.com'>This is a link to yahoo</a></li>
810
<li><a href="http://google.com">This is a link to google</a></li></p>
911
<a href='me.html'>Me</a>
1012

@@ -14,7 +16,7 @@ <h3> I'm a header</h3>
1416
<h1> Hello</h1>
1517
<p>
1618
The time is now:
17-
2013-02-21 23:50:45 -0500
19+
2013-02-21 23:53:24 -0500
1820
</p>
1921

2022
<p>
@@ -27,7 +29,7 @@ <h1> Hello</h1>
2729
<hr />
2830
<div>
2931
<h3> I'm a footer</h3>
30-
<p> <li><a href="http://google.com">This is a link to google</a></li>
32+
<p> <li> <a href='http://yahoo.com'>This is a link to yahoo created with the link_to method</a></li>
3133
<li><a href="http://google.com">This is a link to google</a></li></p>
3234
</div>
3335
</body>

public/me.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
2+
13
<html>
24
<body>
35
<h1>You're using a layout</h1>
46
<p>
57
<h3> I'm a header</h3>
68
<p><ol>
7-
<li><a href="http://google.com">This is a link to google</a></li>
9+
<li><a href='http://yahoo.com'>This is a link to yahoo</a></li>
810
<li><a href="http://google.com">This is a link to google</a></li></p>
911
<a href='me.html'>Me</a>
1012

@@ -16,7 +18,7 @@ <h3> I'm a header</h3>
1618
<hr />
1719
<div>
1820
<h3> I'm a footer</h3>
19-
<p> <li><a href="http://google.com">This is a link to google</a></li>
21+
<p> <li> <a href='http://yahoo.com'>This is a link to yahoo created with the link_to method</a></li>
2022
<li><a href="http://google.com">This is a link to google</a></li></p>
2123
</div>
2224
</body>

public/stephensview.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
2+
13
<html>
24
<body>
35
<h1>You're using a layout</h1>
46
<p>
57
<h3> I'm a header</h3>
68
<p><ol>
7-
<li><a href="http://google.com">This is a link to google</a></li>
9+
<li><a href='http://yahoo.com'>This is a link to yahoo</a></li>
810
<li><a href="http://google.com">This is a link to google</a></li></p>
911
<a href='me.html'>Me</a>
1012

@@ -39,7 +41,7 @@ <h1> Stephen's example page for schneems homework </h1>
3941
<hr />
4042
<div>
4143
<h3> I'm a footer</h3>
42-
<p> <li><a href="http://google.com">This is a link to google</a></li>
44+
<p> <li> <a href='http://yahoo.com'>This is a link to yahoo created with the link_to method</a></li>
4345
<li><a href="http://google.com">This is a link to google</a></li></p>
4446
</div>
4547
</body>

views/layouts/application.html.erb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
<%
2+
def link_to(name, url)
3+
return "<a href='#{url}'>#{name}</a>"
4+
end
5+
%>
6+
17
<html>
28
<body>
39
<h1>You're using a layout</h1>
410
<p>
511
<h3> I'm a header</h3>
612
<p><ol>
7-
<li><a href="http://google.com">This is a link to google</a></li>
13+
<li><%= link_to('This is a link to yahoo', 'http://yahoo.com') %></li>
814
<li><a href="http://google.com">This is a link to google</a></li></p>
915
<a href='me.html'>Me</a>
1016

@@ -16,7 +22,7 @@
1622
<hr />
1723
<div>
1824
<h3> I'm a footer</h3>
19-
<p> <li><a href="http://google.com">This is a link to google</a></li>
25+
<p> <li> <%= link_to('This is a link to yahoo created with the link_to method', 'http://yahoo.com') %></li>
2026
<li><a href="http://google.com">This is a link to google</a></li></p>
2127
</div>
2228
</body>

0 commit comments

Comments
 (0)