Module: DHS::Record::AttributeAssignment

Extended by:
ActiveSupport::Concern
Included in:
DHS::Record
Defined in:
lib/dhs/concerns/record/attribute_assignment.rb

Instance Method Summary collapse

Instance Method Details

#assign_attributes(new_attributes) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/dhs/concerns/record/attribute_assignment.rb', line 8

def assign_attributes(new_attributes)
  unless new_attributes.respond_to?(:stringify_keys)
    raise ArgumentError, "When assigning attributes, you must pass a hash as an argument, #{new_attributes.class} passed."
  end
  return if new_attributes.empty?

  _assign_attributes(new_attributes)
end