val1 = 1
val2 = "1"
if val1 == val2 #< Question is in this line
Convert either to the other, so either:
val1.to_s == val2 # returns true
val1 == val2.to_i # returns true
Although ruby is dynamically typed (the type is known at runtime), it is also strongly typed (the type doesn't get implicitly typecast)