fix load engine error

This commit is contained in:
邱博亞 2024-11-07 22:12:16 +08:00
parent 553fb82adc
commit f7638aa214
2 changed files with 6 additions and 3 deletions

View File

@ -105,6 +105,10 @@ module Announcement
puts ['there_was_no_show_option_method',e]
end
if File.basename($0) != 'rake'
gem_root = Announcement::Engine.root
require File.join(gem_root, 'app/models/bulletin_feed')
require File.join(gem_root, 'app/models/bulletin_feed_cache')
require File.join(gem_root, 'app/models/anns_cache')
begin
avoid_page_cache AnnsCache
avoid_page_cache BulletinFeedCache

View File

@ -7,10 +7,9 @@ module Announcement
require File.join(gem_root, 'app/models/bulletin')
require File.join(gem_root, 'app/models/bulletin_feed')
require File.join(gem_root, 'app/models/bulletin_feed_cache')
require File.join(gem_root, 'app/models/anns_cache')
require File.join(Announcement::Engine.root, 'app/models/anns_cache')
setting = AnnouncementSetting.first
setting = AnnouncementSetting.first || AnnouncementSetting.create
if !setting.migrate_flag.include?("v1")
Bulletin.all.pluck(:id, :title).each do |id, title_translations|