Class: ImportDocument
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ImportDocument
- Defined in:
- app/models/import_document.rb
Overview
ImportDocument class
Instance Method Summary collapse
Instance Method Details
#nullify_empty_json_attributes ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/models/import_document.rb', line 25 def nullify_empty_json_attributes clean_hash = {} json_attributes.each do |key, value| clean_hash[key] = value.present? ? value : nil end clean_hash end |
#state_machine ⇒ Object
12 13 14 |
# File 'app/models/import_document.rb', line 12 def state_machine @state_machine ||= ImportDocumentStateMachine.new(self, transition_class: ImportDocumentTransition) end |
#to_hash ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/models/import_document.rb', line 16 def to_hash { friendlier_id: friendlier_id, title: title, json_attributes: nullify_empty_json_attributes, import_id: import_id } end |