Flowdock
method

has_attribute?

Importance_1
v4.0.2 - Show latest stable - 0 notes - 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
Show source
Register or log in to add new notes.