diff --git a/lib/announcement/engine.rb b/lib/announcement/engine.rb index af949e3..a1278dd 100644 --- a/lib/announcement/engine.rb +++ b/lib/announcement/engine.rb @@ -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 diff --git a/lib/announcement/migrate.rb b/lib/announcement/migrate.rb index 8c7befe..f705722 100644 --- a/lib/announcement/migrate.rb +++ b/lib/announcement/migrate.rb @@ -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|