Class: SlimFormObject::Assign

Inherits:
Object
  • Object
show all
Includes:
HelperMethods
Defined in:
lib/slim_form_object/assign.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HelperMethods

#apply_expression_text, #get_association, #get_class_of_snake_model_name, #get_self_object, #snake, #to_bind_models

Constructor Details

#initialize(form_object) ⇒ Assign

Returns a new instance of Assign.



7
8
9
10
11
12
13
14
# File 'lib/slim_form_object/assign.rb', line 7

def initialize(form_object)
  @form_object                 = form_object
  @base_module                 = form_object.class.base_module
  @params                      = form_object.params
  @array_all_objects_for_save  = form_object.array_all_objects_for_save
  @validator                   = Validator.new(form_object)
  @all_updated_objects         = []
end

Instance Attribute Details

#all_updated_objectsObject (readonly)

Returns the value of attribute all_updated_objects.



5
6
7
# File 'lib/slim_form_object/assign.rb', line 5

def all_updated_objects
  @all_updated_objects
end

#base_moduleObject (readonly)

Returns the value of attribute base_module.



5
6
7
# File 'lib/slim_form_object/assign.rb', line 5

def base_module
  @base_module
end

#form_objectObject (readonly)

Returns the value of attribute form_object.



5
6
7
# File 'lib/slim_form_object/assign.rb', line 5

def form_object
  @form_object
end

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'lib/slim_form_object/assign.rb', line 5

def params
  @params
end

#validatorObject (readonly)

Returns the value of attribute validator.



5
6
7
# File 'lib/slim_form_object/assign.rb', line 5

def validator
  @validator
end

Instance Method Details

#apply_parametersObject



16
17
18
19
20
21
# File 'lib/slim_form_object/assign.rb', line 16

def apply_parameters
  make_all_objects_with_attributes
  clear_nil_objects

  all_updated_objects
end

#associate_objectsObject



23
24
25
26
27
# File 'lib/slim_form_object/assign.rb', line 23

def associate_objects
  associate_all_objects(all_updated_objects)

  all_updated_objects
end