Module: FormObj::ModelMapper::ClassMethods

Defined in:
lib/form_obj/model_mapper.rb

Instance Method Summary collapse

Instance Method Details

#array_classObject



19
20
21
# File 'lib/form_obj/model_mapper.rb', line 19

def array_class
  ModelMapper::Array
end

#attribute_classObject



15
16
17
# File 'lib/form_obj/model_mapper.rb', line 15

def attribute_class
  ModelMapper::Attribute
end

#load_from_model(*args) ⇒ Object



31
32
33
# File 'lib/form_obj/model_mapper.rb', line 31

def load_from_model(*args)
  new.load_from_model(*args)
end

#load_from_models(*args) ⇒ Object



35
36
37
# File 'lib/form_obj/model_mapper.rb', line 35

def load_from_models(*args)
  new.load_from_models(*args)
end

#model_hash=(value) ⇒ Object



23
24
25
# File 'lib/form_obj/model_mapper.rb', line 23

def model_hash=(value)
  _attributes.each { |attribute| attribute.model_attribute.hash_item = value }
end

#model_primary_keyObject



27
28
29
# File 'lib/form_obj/model_mapper.rb', line 27

def model_primary_key
  ModelMapper::ModelPrimaryKey.new(_attributes.find(primary_key).model_attribute)
end