Module: MappableObjectAttributes::MappableData

Extended by:
ActiveSupport::Concern
Defined in:
lib/mappable_object_attributes/mappable_data.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#assign_attributes_from_hash(hash_object, mapname = :default) ⇒ Object

usage: convenience method that calls:

- make_hash_from
- makes attributes accessible
- assign_attributes
part of #build_from_map


101
102
103
104
105
106
# File 'lib/mappable_object_attributes/mappable_data.rb', line 101

def assign_attributes_from_hash(hash_object, mapname=:default)
  msh = self.class.make_hash_from(hash_object, mapname)
  accessible_msh = self.class.make_mapped_atts_accessible(msh)

  self.assign_attributes(accessible_msh)
end