Class: Para::ComponentsCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/para/components_cleaner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject

Hide class instanciation



6
7
8
# File 'lib/para/components_cleaner.rb', line 6

def self.run
  new.run
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/para/components_cleaner.rb', line 10

def run
  components.each do |component|
    if component.id != Para.components.components_ids_hash[component.identifier]
      component.destroy
    end
  end

  Para::ComponentSection.find_each do |section|
    unless Para.components.sections_ids_hash[section.identifier]
      section.destroy
    end
  end
end