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
Ruby has a function called respond_to? that can be used to seeing if a particular class or object has a method with a certain name. The syntax is something like
User.respond_to?('name') # returns true is method name exists
otherwise false
http://www.prateekdayal.net/2007/10/16/rubys-responds_to-for-checking-if-a-method-exists/