Skip to content

Instantly share code, notes, and snippets.

@sqfmason
Created October 5, 2015 02:03
Show Gist options
  • Save sqfmason/924e633e6bfadb7ad446 to your computer and use it in GitHub Desktop.
Save sqfmason/924e633e6bfadb7ad446 to your computer and use it in GitHub Desktop.
class TipController < ApplicationController
def form
@meal_cost = params[:meal]
@tip_percent= params[:tip]
@amount_of_people= params[:amount]
end
end
def result
result = (@meal_cost * @tip_percent/100)/@amount_of_people
render result
end
Error message
NoMethodError in Tip#result
Showing /Users/Qureshi/Desktop/learning ruby/omnicalc/checkpoint-1/tip_calculator/app/views/tip/result.html.erb where line #5 raised:
undefined method `*' for nil:NilClass
Extracted source (around line #10):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment