method

has_attribute?

Importance_1
v5.1.7 - Show latest stable - 0 notes - Class: ActiveRecord::AttributeMethods::ClassMethods
has_attribute?(attr_name) public

Returns true if the given attribute exists, otherwise false.

class Person < ActiveRecord::Base
end

Person.has_attribute?('name')   # => true
Person.has_attribute?(:age)     # => true
Person.has_attribute?(:nothing) # => false
Show source
Register or log in to add new notes.