mongoid/mongoid — Issue #1484: Make has_attribute? more like ActiveRecord
Author: mikeycgto
Created: 2011-12-07 19:10:28+00:00
State: open

Presently, `has_attribute?` is significantly different than what ActiveRecord does. Here is AR's definition:

# File activerecord/lib/active_record/base.rb, line 1667
def has_attribute?(attr_name)
@attributes.has_key?(attr_name.to_s)
end

Currently, `has_attribute?` is simply an alias to `attribute_present?`

def attribute_present?(name)
attribute = read_attribute(name)
! attribute.blank? || attribute == false
end
alias :has_attribute? :attribute_present?