Skip to content

Instantly share code, notes, and snippets.

@chadoh
Created June 26, 2013 01:45
Show Gist options
  • Save chadoh/5864122 to your computer and use it in GitHub Desktop.
Save chadoh/5864122 to your computer and use it in GitHub Desktop.
require 'sinatra'
get '/' do
haml :index
end
get '/result' do
loan_eligibility = params[:loan_length]/params[:loan_amount] + params[:income] - params[:expenses]
haml :result
end
__END__
@@ layout
%html
%head
%title Terrible Loan Calculator
%body
= yield
@@ index
%h1 Enter a potential customer's details and find out if they qualify for a loan!
%form(method='get' action='/result')
%input(type='text' name='loan_length' placeholder='loan_length')
%input(type='text' name='loan_amount' placeholder='loan_amount')
%input(type='text' name='income' placeholder='income')
%input(type='text' name='expenses' placeholder='expenses')
%input(type='submit' value='Determine loan eligibility')
@@ result
%h1 Loan Eligibility: #{loan_eligibility}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment