Module: LHS::Record::AttributeAssignment

Extended by:
ActiveSupport::Concern
Included in:
LHS::Record
Defined in:
lib/lhs/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/lhs/concerns/record/attribute_assignment.rb', line 8

def assign_attributes(new_attributes)
  if !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