Skip to content

Commit

Permalink
Update WorkResourceGenerator
Browse files Browse the repository at this point in the history
This update will include the lazy migration line if the work ends with
'Resource' and the 'migrating from' work already exists.
  • Loading branch information
kirkkwang committed May 16, 2024
1 parent 20aca2c commit 896e1b6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ def insert_hyku_works_controller_behavior

def insert_hyku_extra_includes_into_model
model = File.join('../app/models/', class_path, "#{file_name}.rb")
af_model = "#{class_name}".gsub('Resource', '')&.safe_constantize if class_name.end_with?('Resource')
insert_into_file model, before: "end" do
<<-RUBY.gsub(/^ {8}/, ' ')
include Hyrax::Schema(:with_pdf_viewer)
include Hyrax::Schema(:with_video_embed)
include Hyrax::ArResource
include Hyrax::NestedWorks
#{ "\n Hyrax::ValkyrieLazyMigration.migrating(self, from: #{af_model})\n" if af_model }
include IiifPrint.model_configuration(
pdf_split_child_model: GenericWorkResource,
pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter
Expand Down

0 comments on commit 896e1b6

Please sign in to comment.