I googled that there is an is_a? function to check whether an object is an integer or not.
But I tried in rails console, and it doesn't work.
I ran the code like the following:
"1".is_a?
1.is_a?
Did I miss something?
You forgot to include the class you were testing against:
"1".is_a?(Integer) # false
1.is_a?(Integer) # true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With