diff --git a/app/models/communication/block/template.rb b/app/models/communication/block/template.rb index 43c3cafa0c37d4c799d6c111a6b78c9926c7e0b8..2eed4643d11775c3ae08abde14ce3cf2f5c03790 100644 --- a/app/models/communication/block/template.rb +++ b/app/models/communication/block/template.rb @@ -7,6 +7,7 @@ class Communication::Block::Template def git_dependencies unless @git_dependencies + @git_dependencies = [] build_git_dependencies @git_dependencies.uniq! end diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index 09d7980d77629f465a5144e2a5da55eca12d60dd..89b6ff7a9e5abf6fae93de9a005c937736b1cd79 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -33,22 +33,23 @@ ActiveStorage::Filename.class_eval do end end -module ActiveStorageGitPathStatic - extend ActiveSupport::Concern +# https://stackoverflow.com/questions/8895103/how-can-i-keep-my-initializer-configuration-from-being-lost-in-development-mode +Rails.application.config.to_prepare do + module ActiveStorageGitPathStatic + extend ActiveSupport::Concern - included do - has_many :git_files, class_name: "Communication::Website::GitFile", as: :about, dependent: :destroy - end + included do + has_many :git_files, class_name: "Communication::Website::GitFile", as: :about, dependent: :destroy + end - def git_path(website) - "data/media/#{id[0..1]}/#{id}.yml" - end + def git_path(website) + "data/media/#{id[0..1]}/#{id}.yml" + end - def before_git_sync - analyze unless analyzed? + def before_git_sync + analyze unless analyzed? + end end -end -ActiveSupport::Reloader.to_prepare do ActiveStorage::Blob.include ActiveStorageGitPathStatic end