module ActiveModel::Validations::ClassMethods

def attribute_method?(attribute)

User.attribute_method?(:age) # => false
User.attribute_method?(:name) # => true

end
attr_accessor :name

include ActiveModel::Validations
class Person

Returns +true+ if +attribute+ is an attribute method, +false+ otherwise.
def attribute_method?(attribute)
  method_defined?(attribute)
end