Class: SlimFormObject::Saver
- Inherits:
-
Object
- Object
- SlimFormObject::Saver
- Includes:
- HelperMethods
- Defined in:
- lib/slim_form_object/saver.rb
Instance Attribute Summary collapse
-
#data_objects_arr ⇒ Object
readonly
Returns the value of attribute data_objects_arr.
-
#form_object ⇒ Object
readonly
Returns the value of attribute form_object.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Instance Method Summary collapse
-
#initialize(form_object) ⇒ Saver
constructor
A new instance of Saver.
- #save ⇒ Object
- #save! ⇒ Object
Methods included from HelperMethods
#assignment_to_each_other, #class_name_if_module, #define_classes_array_with_name, #get_class_of, #get_reflection, #get_self_object, #get_type_and_name_of_association, #iterate_parents_with_nested_objects, #make_constant_name, #method_name_association, #snake, #to_bind_models, #type_and_name_of_association_back_and_forth, #type_association
Constructor Details
#initialize(form_object) ⇒ Saver
Returns a new instance of Saver.
7 8 9 10 11 12 |
# File 'lib/slim_form_object/saver.rb', line 7 def initialize(form_object) @form_object = form_object @params = form_object.params @data_objects_arr = form_object.data_objects_arr @validator = Validator.new(form_object) end |
Instance Attribute Details
#data_objects_arr ⇒ Object (readonly)
Returns the value of attribute data_objects_arr.
5 6 7 |
# File 'lib/slim_form_object/saver.rb', line 5 def data_objects_arr @data_objects_arr end |
#form_object ⇒ Object (readonly)
Returns the value of attribute form_object.
5 6 7 |
# File 'lib/slim_form_object/saver.rb', line 5 def form_object @form_object end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/slim_form_object/saver.rb', line 5 def params @params end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
5 6 7 |
# File 'lib/slim_form_object/saver.rb', line 5 def validator @validator end |
Instance Method Details
#save ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/slim_form_object/saver.rb', line 14 def save if form_object.valid? _save return true end false rescue false end |
#save! ⇒ Object
24 25 26 |
# File 'lib/slim_form_object/saver.rb', line 24 def save! _save end |