method
respond_to?
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
respond_to?(name, include_private = false)
public
A Person object with a name attribute can ask person.respond_to?(:name), person.respond_to?(:name=), and person.respond_to?(:name?) which will all return true. It also defines the attribute methods if they have not been generated.
class Person < ActiveRecord::Base end person = Person.new person.respond_to?(:name) # => true person.respond_to?(:name=) # => true person.respond_to?(:name?) # => true person.respond_to?('age') # => true person.respond_to?('age=') # => true person.respond_to?('age?') # => true person.respond_to?(:nothing) # => false