Sunday, 14 March 2010 15:01
Source:
ruby’s respond_to? for checking if a method exists [prateekdayal.net]
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

Read more: