Flowdock
has_attribute?(attr_name) public

Returns true if the given attribute is in the attributes hash, otherwise false.

class Person < ActiveRecord::Base
  alias_attribute :new_name, :name
end

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