Hiya beginners,

yeah i know only beginners would end up landing this thread becasue this error is faced at beginning level of rails programming. Well it is simple and very logical error, as you are trying to compare a string with an integer. oh ok, you know logic, i m sorry to waste your time. Here is the workaround, if say num is the variable then convert ot typecaste it using the following code.

num=num.to_i

This will convert num into integer and your condition will execute without halting 😛

cheers !!
Realin !

Share this post: