Flowdock
method

has_attribute?

Importance_1
v6.1.7.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
  alias_attribute :new_name, :name
end

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.