To Examples

TemperatureConverter1 Example -- with Errors Corrected

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' do %> <-- Insert single quotes, insert do
                              <-- Delete = from =%>
<p><%= text_field_tag :cel, '', class: 'ctrl' %><br /></p>
<p><%= submit_tag 'Convert Temperature', class: 'ctrl' ></p>  <-- Change class => to class:
<% end %>

---- TemperatureConverter1/app/views/convert/display.html.erb ---------

<h1>Display Converted Temperature</h1>

<p>Celsius Temperature: <%= @c %></p>       <-- Insert =
<p>Fahrenheit Temperature: <%= @f %></p>    <-- Insert <%= and %>
<p><%= link_to 'Input another Temperature', <-- Insert comma
   convert_input_path %></p>


---- TemperatureConverter1/app/controllers/convert_controller.rb ------

class ConvertController < ApplicationController

  def input
  end 

  def display   <-- Change convert to display
    @c = params[:fahr].to_s  <-- Change :fahr to :cel, change to_s to to_i
    @f = 9 * @c / 5 + 32
  end
end

---- TemperatureConverter1/app/assets/stylesheets/convert.scss ------

* { background_color: #fffff0;
  color; #444444;          <-- Change ; to :, add ; at end of line.
  font-family: Verdana;  }

.ctrl { width: 165in; }    <-- Change in to px

a { color: #0000a0; }   <-- Add }

---- TemperatureConverter1/config/routes.rb ------------------------

Rails.application.routes.draw do   <-- Insert do
  get 'convert/input'
  get 'convert/display'
  post 'convert/display'  <--  Insert this line.
end

--------------------------------------------------------------------