Module: ActiveRecord::AttributeMethods

Defined in:
lib/composite_primary_keys/attribute_methods.rb,
lib/composite_primary_keys/attribute_methods/read.rb,
lib/composite_primary_keys/attribute_methods/write.rb,
lib/composite_primary_keys/attribute_methods/primary_key.rb

Defined Under Namespace

Modules: PrimaryKey, Read, Write

Instance Method Summary collapse

Instance Method Details

#has_attribute?(attr_name) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
# File 'lib/composite_primary_keys/attribute_methods.rb', line 3

def has_attribute?(attr_name)
  # CPK
  # @attributes.key?(attr_name.to_s)
  Array(attr_name).all?{|single_attr| @attributes.key?(single_attr.to_s) }
end