Class: Hyrax::RequiredDataSeeders::FlexibleProfileSeeder
- Inherits:
-
Object
- Object
- Hyrax::RequiredDataSeeders::FlexibleProfileSeeder
- Defined in:
- app/utils/hyrax/required_data_seeders/flexible_profile_seeder.rb
Overview
This class was created for use in rake tasks and db/seeds.rb. It generates collections that are required for all Hyrax applications.
Seeders of required data are non-destructive. If the data already exists, it will not be replaced.
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'app/utils/hyrax/required_data_seeders/flexible_profile_seeder.rb', line 12 def logger @logger end |
Class Method Details
.generate_seeds(logger: Logger.new(STDOUT)) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/utils/hyrax/required_data_seeders/flexible_profile_seeder.rb', line 14 def generate_seeds(logger: Logger.new(STDOUT)) @logger = logger logger.info("Adding required collections...") flexible_schema = Hyrax::FlexibleSchema.first_or_create do |f| f.profile = YAML.safe_load_file(Rails.root.join('config', 'metadata_profiles', 'm3_profile.yaml')) end logger.info " #{flexible_schema.title} -- FOUND OR CREATED" end |