To Examples
TemperatureConverter1 Example -- with Errors
Find the errors in these source code files (about 5 errors per file):
---- TemperatureConverter1/app/views/convert/input.html.erb ---------
<h1>Input Fahrenheit Temperature</h1>
<%= form_tag display =%>
<p><%= text_field_tag :cel, '', class: 'ctrl' %><br /></p>
<p><%= submit_tag 'Convert Temperature', class => 'ctrl' ></p>
<% end %>
---- TemperatureConverter1/app/views/convert/display.html.erb ---------
<h1>Display Converted Temperature</h1>
<p>Celsius Temperature: <% @c %></p>
<p>Fahrenheit Temperature: @f</p>
<p><%= link_to 'Input another Temperature'
convert_input_path %></p>
---- TemperatureConverter1/app/controllers/convert_controller.rb ------
class ConvertController < ApplicationController
def input
def convert
@c = params[:fahr].to_s
@f = 9 * @c / 5 + 32
end
end
---- TemperatureConverter1/app/assets/stylesheets/convert.scss ------
* { background_color: #fffff0;
color; #444444
font-family: Verdana;
}
.ctrl { width: 165in; }
a { color: #0000a0;
---- TemperatureConverter1/config/routes.rb ------------------------
Rails.application.routes.draw
get 'convert/input'
get 'convert/display'
end
--------------------------------------------------------------------