Class: Usage
Class Method Summary
collapse
Instance Method Summary
collapse
aggregate_of, all_except, defaults, #delete, #destroy!, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, #update_and_notify!, update_or_create!, whitelist_attributes
Class Method Details
.destroy_all_where(query) ⇒ Object
12
13
14
|
# File 'app/models/usage.rb', line 12
def self.destroy_all_where(query)
where(query).destroy_all
end
|
.destroy_usages_for(record) ⇒ Object
16
17
18
|
# File 'app/models/usage.rb', line 16
def self.destroy_usages_for(record)
destroy_all_where(parent_item: record)
end
|
Instance Method Details
#destroy_children_usages! ⇒ Object
20
21
22
|
# File 'app/models/usage.rb', line 20
def destroy_children_usages!
item.structural_children.each { |child| Usage.destroy_all_where(parent_item: child, organization: organization) }
end
|
#index_children!(children) ⇒ Object
24
25
26
|
# File 'app/models/usage.rb', line 24
def index_children!(children)
children.each { |it| it.index_usage! organization }
end
|