Created
October 5, 2015 02:12
-
-
Save sqfmason/a1568e6fc22149c905e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TipController < ApplicationController | |
def form | |
@meal_cost = params[:meal].to_i | |
@tip_percent= params[:tip].to_i | |
@amount_of_people= params[:amount].to_i | |
end | |
end | |
def result | |
@meal_cost = params[:meal].to_i | |
@tip_percent= params[:tip].to_i | |
@amount_of_people= params[:amount].to_i | |
result = (@meal_cost.to_i * @tip_percent/100.to_i)/@amount_of_people.to_i | |
render result | |
end | |
ZeroDivisionError in Tip#result | |
Showing /Users/Qureshi/Desktop/learning ruby/omnicalc/checkpoint-1/tip_calculator/app/views/tip/result.html.erb where line #5 raised: | |
divided by 0 | |
Extracted source (around line #14): | |
@amount_of_people= params[:amount].to_i | |
result = (@meal_cost.to_i * @tip_percent/100.to_i)/@amount_of_people.to_i | |
render result | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment