Created
October 5, 2015 02:24
-
-
Save sqfmason/be0cdbcbe28bdf4c1951 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] | |
@tip_percent= params[:tip] | |
@amount_of_people= params[:amount] | |
@result = (@meal_cost.to_i * @tip_percent/100.to_f)/ @amount_of_people.to_i | |
render @result | |
end | |
TypeError in Tip#result | |
Showing /Users/Qureshi/Desktop/learning ruby/omnicalc/checkpoint-1/tip_calculator/app/views/tip/result.html.erb where line #5 raised: | |
String can't be coerced into Fixnum | |
Extracted source (around line #13): | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
@tip_percent= params[:tip] | |
@amount_of_people= params[:amount] | |
@result = (@meal_cost.to_i * @tip_percent/100.to_f)/ @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