Jupiter is a University of Alberta Libraries-based initiative to create a sustainable and extensible digital asset management system. This is phase 2 (Digitization).
11.times do |_i|
Digitization::Book.new(peel_id: rand(1..3400), part_number: rand(1..100),
owner_id: admin.id,
dates_issued: [rand(1900..2020).to_s],
date_ingested: '2016-12-08T06:00:00.000Z',
title: "#{Faker::Company.name} #{Faker::WorldCup.city} Music Festival",
alternative_titles: [Faker::Hipster.sentence.to_s],
resource_type: ControlledVocabulary.digitization.resource_type.from_value('Text'),
genres: [ControlledVocabulary.digitization.genre.from_value('Programs (Publications)')],
languages: [ControlledVocabulary.digitization.language.from_value('English')],
publishers: [ControlledVocabulary.digitization.subject.from_value('Edmonton Folk Music Festival')],
places_of_publication: [ControlledVocabulary.digitization.location.from_value('Edmonton (Alta.)')],
extent: 'v. : ill. ; 22-27 cm.',
notes: ['Souvenir program of the festival, including biographical notes on and portraits and discographies of the performers, articles, etc.', Faker::Hipster.sentence.to_s],
temporal_subjects: ['1981'],
geographic_subjects: [ControlledVocabulary.digitization.location.from_value('Edmonton (Alta.)')],
topical_subjects: [ControlledVocabulary.digitization.subject.from_value('Folk music festivals')],
rights: ControlledVocabulary.digitization.rights.from_value('In Copyright')
).tap do |book|
book.create_fulltext(text: Faker::Lorem.sentence(word_count: 250, supplemental: false, random_words_to_add: 0))
book.save!
end # Folk Fest
end
This code is giving an ActiveRecord::RecordNotSaved: You cannot call create unless the parent is saved error on the book.create_fulltext(...).
I think if we change Digitization::Book.new to Digitization::Book.create and remove the book.save! then this should fix it 🤔
Seeds are currently failing here:
This code is giving an
ActiveRecord::RecordNotSaved: You cannot call create unless the parent is saved
error on thebook.create_fulltext(...)
.I think if we change
Digitization::Book.new
toDigitization::Book.create
and remove thebook.save!
then this should fix it 🤔