has_attribute?(attr_name)
Instance Public methods
Returns true
if the given attribute is in the attributes hash,
otherwise false
.
1 2 3 4 5 6 7 | class Person < ActiveRecord::Base end person = Person. new person.has_attribute?( :name ) # => true person.has_attribute?( 'age' ) # => true person.has_attribute?( :nothing ) # => false |
Please login to continue.