Your input appears to be coming in as a string. This is normal for a text box, might be a little less expected if your input field is supposed to only take a number. You will need to convert it to a number, and because you are dividing them and expect to get, say, 7 / 2 = 3.5 instead of 7 / 2 = 3, you probably want that number to be a float. You can call to_f to convert a string to a float. If it is possible to put anything other than a number into that input box, to_f will fail when the input is not (just) a number, ex. '15f', 'lots'. You will probably want to handle that error.