Update site model.

This commit is contained in:
BoHung Chiu 2021-12-02 10:38:48 +08:00
parent a8be974144
commit 8f66372f83
1 changed files with 3 additions and 1 deletions

View File

@ -119,6 +119,7 @@ class Site
field :has_sub_home , :type => Boolean, :default => false
field :prohibit_general_memebers_access_backend_member_page , :type => Boolean, :default => false
field :avoid_member_display_in_wrong_show_page , :type => Boolean, :default => true
field :tmp_flags, :type => Array, :default => []
mount_uploader :default_image, ImageUploader
mount_uploader :site_logo, ImageUploader
mount_uploader :site_logo_1, ImageUploader
@ -241,6 +242,7 @@ class Site
end
def reset_cache
localize_true = self.in_use_locales.map{|l| [l.to_s,true]}.to_h
self.class.all.update_all(:need_update_header_cache=>localize_true,:need_update_mobile_header_cache=>localize_true,:need_update_menu_cache=>localize_true,:need_update_mobile_menu_cache=>localize_true)
localize_str = self.in_use_locales.map{|l| [l.to_s,""]}.to_h
self.class.all.update_all(:cache_menu_data=>localize_str,:cache_header_data=>localize_str,:mobile_cache_menu_data=>localize_str,:mobile_cache_header_data=>localize_str,:need_update_header_cache=>localize_true,:need_update_mobile_header_cache=>localize_true,:need_update_menu_cache=>localize_true,:need_update_mobile_menu_cache=>localize_true)
end
end