Module: Notes
- Defined in:
- backend/app/model/mixins/notes.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#persistent_id_context ⇒ Object
-
#update_from_json(json, opts = {}, apply_nested_records = true) ⇒ Object
Class Method Details
.included(base) ⇒ Object
8 9 10 11 12 13 14 |
# File 'backend/app/model/mixins/notes.rb', line 8 def self.included(base) base.one_to_many :note Note.many_to_one base.table_name base.extend(ClassMethods) end |
Instance Method Details
#persistent_id_context ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'backend/app/model/mixins/notes.rb', line 23 def persistent_id_context if self.respond_to?(:root_record_id) && self.root_record_id parent_id = self.root_record_id parent_type = self.class.root_record_type.to_s else parent_id = self.id parent_type = self.class.my_jsonmodel.record_type end [parent_id, parent_type] end |
#update_from_json(json, opts = {}, apply_nested_records = true) ⇒ Object
17 18 19 20 |
# File 'backend/app/model/mixins/notes.rb', line 17 def update_from_json(json, opts = {}, apply_nested_records = true) obj = super self.class.apply_notes(obj, json) end |