module ActiveRecord::AttributeMethods

Public Instance Methods

_has_attribute?(attr_name) click to toggle source
# File lib/composite_primary_keys/attribute_methods.rb, line 15
def _has_attribute?(attr_name)
  # CPK
  # @attributes.key?(attr_name)
  Array(attr_name).all? { |attr| @attributes.key?(attr) }
end
has_attribute?(attr_name) click to toggle source
# File lib/composite_primary_keys/attribute_methods.rb, line 3
def has_attribute?(attr_name)
  # CPK
  # attr_name = attr_name.to_s
  # attr_name = self.class.attribute_aliases[attr_name] || attr_name
  # @attributes.key?(attr_name)
  Array(attr_name).all? do |attr|
    attr = attr.to_s
    attr = self.class.attribute_aliases[attr] || attr
    @attributes.key?(attr)
  end
end