Method: Volt::ModelHelpers#self_attributes

Defined in:
lib/volt/models/model_helpers/model_helpers.rb

#self_attributesObject

Return the attributes that are only for this model and any hash sub models but not any sub-associations.



37
38
39
40
41
42
43
44
45
46
# File 'lib/volt/models/model_helpers/model_helpers.rb', line 37

def self_attributes
  # Don't store any sub-models, those will do their own saving.
  attributes.reject { |k, v| v.is_a?(ArrayModel) }.map do |k,v|
    if v.is_a?(Model)
      v = v.self_attributes
    end

    [k,v]
  end.to_h
end