Class: Hyrax::DataDestroyers::CollectionTypesDestroyer

Inherits:
Object
  • Object
show all
Defined in:
app/utils/hyrax/data_destroyers/collection_types_destroyer.rb

Overview

Note:

WARNING: DO NOT USE IN PRODUCTION! The methods in this class are destructive. Data can not be recovered.

Collection types are recreated by the release seed data. Clear out here to start with a fresh set.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



12
13
14
# File 'app/utils/hyrax/data_destroyers/collection_types_destroyer.rb', line 12

def logger
  @logger
end

Class Method Details

.destroy_data(logger: Logger.new(STDOUT), allow_destruction_in_production: false) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'app/utils/hyrax/data_destroyers/collection_types_destroyer.rb', line 14

def destroy_data(logger: Logger.new(STDOUT), allow_destruction_in_production: false)
  raise("CollectionTypesDestroyer is not for use in production!") if Rails.env.production? && !allow_destruction_in_production
  @logger = logger

  logger.info("Destroying collection types...")

  Hyrax::CollectionType.destroy_all
  logger.info("   collection types -- DESTROYED")
end