method
has_attribute?
v4.2.1 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods
has_attribute?(attr_name)public
Returns true if the given attribute is in the attributes hash, otherwise false.
class Person < ActiveRecord::Base end person = Person.new person.has_attribute?(:name) # => true person.has_attribute?('age') # => true person.has_attribute?(:nothing) # => false