Module: ObjectAttorney::AttributeAssignment

Defined in:
lib/object_attorney/attribute_assignment.rb

Instance Method Summary collapse

Instance Method Details

#assign_attributes(attributes = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/object_attorney/attribute_assignment.rb', line 5

def assign_attributes(attributes = {})
  return if attributes.blank?

  attributes.each do |name, value|
    name, value = check_for_hidden_nested_attributes(name, value)
    send("#{name}=", value) if allowed_attribute(name)
  end

  mark_for_destruction_if_necessary(self, attributes)
end