Class: Classification
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Classification
show all
- Includes:
- ASModel, ClassificationIndexing, Publishable, Relationships, Trees
- Defined in:
- backend/app/model/classification.rb
Constant Summary
Constant Summary
Constants included
from Trees
Trees::NODE_PAGE_SIZE
Instance Attribute Summary
#cached_relationships
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
db_value_for, included
#reindex_children
Methods included from Trees
#adopt_children, #assimilate, #build_node_query, #children, included, #partial_tree, #transfer_to_repository, #tree, #trigger_index_of_entire_tree
#assimilate, #cache_relationships, included, #my_relationships, #related_records, #transfer_to_repository, #trigger_reindex_of_dependants
Methods included from ASModel
all_models, included, update_publish_flag, update_suppressed_flag
Methods included from JSONModel
JSONModel, #JSONModel, add_error_handler, all, allow_unmapped_enum_value, backend_url, client_mode?, custom_validations, destroy_model, enum_default_value, enum_values, handle_error, init, load_schema, #models, models, parse_jsonmodel_ref, parse_reference, repository, repository_for, schema_src, set_repository, strict_mode, strict_mode?, with_repository
Class Method Details
+ (Object) create_from_json(json, opts = {})
30
31
32
33
34
35
|
# File 'backend/app/model/classification.rb', line 30
def self.create_from_json(json, opts = {})
self.set_path_from_root(json)
obj = super
obj.reindex_children
obj
end
|
+ (Object) sequel_to_jsonmodel(objs, opts = {})
46
47
48
49
50
51
52
53
54
|
# File 'backend/app/model/classification.rb', line 46
def self.sequel_to_jsonmodel(objs, opts = {})
jsons = super
jsons.each do |json|
self.set_path_from_root(json)
end
jsons
end
|
+ (Object) set_path_from_root(json)
25
26
27
|
# File 'backend/app/model/classification.rb', line 25
def self.set_path_from_root(json)
json['path_from_root'] = [{'title' => json.title, 'identifier' => json.identifier}]
end
|
Instance Method Details
- (Object) load_node_properties(node, properties, ids_of_interest = :all)
57
58
59
60
|
# File 'backend/app/model/classification.rb', line 57
def load_node_properties(node, properties, ids_of_interest = :all)
super
properties[node.id][:identifier] = node.identifier
end
|
- (Object) load_root_properties(properties, ids_of_interest = :all)
63
64
65
66
|
# File 'backend/app/model/classification.rb', line 63
def load_root_properties(properties, ids_of_interest = :all)
super
properties[:identifier] = self.identifier
end
|
- (Object) update_from_json(json, opts = {}, apply_nested_records = true)
38
39
40
41
42
43
|
# File 'backend/app/model/classification.rb', line 38
def update_from_json(json, opts = {}, apply_nested_records = true)
self.class.set_path_from_root(json)
obj = super
obj.reindex_children
obj
end
|