Mix Ruby Code and HTML : ERB « Rails « Ruby
- Ruby
- Rails
- ERB
Mix Ruby Code and HTML
<html>
<head>
<title>Using Views</title>
</head>
<body>
<h1>Working With Views</h1>
This is an active view in a Ruby on Rails application.
<br>
<br>
2 + 3 = <%= 2 + 3 %>
<br>
<br>
Do loops work?
<br>
<% 3.times do %>
Yes! <br>
<% end %>
<br>
This page executes Ruby code on-the-fly.
</body>
</html>
mixHTMLRuby.zip( 88 k)Related examples in the same category