Class: Hyrax::DefaultAdministrativeSet
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Hyrax::DefaultAdministrativeSet
- Defined in:
- app/models/hyrax/default_administrative_set.rb
Overview
This class stores the id of the default ‘Hyrax::AdministrativeSet`. This is used to populate a cache of the default admin set in Hyrax::Configuration.
Class Method Summary collapse
- .save_supported? ⇒ Boolean
-
.update(default_admin_set_id:) ⇒ Object
Set the default admin set id in the first record.
Class Method Details
.save_supported? ⇒ Boolean
28 29 30 |
# File 'app/models/hyrax/default_administrative_set.rb', line 28 def save_supported? ActiveRecord::Base.connection.table_exists? table_name end |
.update(default_admin_set_id:) ⇒ Object
Set the default admin set id in the first record.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/hyrax/default_administrative_set.rb', line 15 def update(default_admin_set_id:) validate_id(default_admin_set_id) Hyrax.config.reset_default_admin_set # saving default_admin_set_id for the first time return new(default_admin_set_id: default_admin_set_id.to_s).save if count.zero? # replacing previously saved default_admin_set_id existing = first existing.default_admin_set_id = default_admin_set_id.to_s existing.save end |