-
Notifications
You must be signed in to change notification settings - Fork 10
Developer Notes
Valerie Maher edited this page Mar 30, 2016
·
18 revisions
# Decide what visibility you want the monograph to have
vis = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
# A monograph is required to have a title
monograph = Monograph.new(title: ['Monograph #1'], visibility: vis)
# The person who created the monograph must have edit access to the monograph
monograph.apply_depositor_metadata('admin@example.com')
monograph.save!
chapter1 = Section.new(title: ['Chapter 1'], visibility: vis)
chapter1.apply_depositor_metadata('admin@example.com')
chapter1.save!
# Add the section to the monograph
monograph.ordered_members << chapter1
monograph.save!
If you re-start solr, you'll need to reindex all your fedora objects. Otherwise, none of your monographs or files will be visible in the UI.
Note: In order to get all the objects correctly indexed, including all their associations, you need to reindex twice.
ActiveFedora::Base.reindex_everything
Then again
ActiveFedora::Base.reindex_everything
Not recommended for production environments, but useful for dev or test environments, when you want to start with a clean slate. This will delete everything in fedora.
In the rails console:
require 'active_fedora/cleaner'
ActiveFedora::Cleaner.clean!