This commit is contained in:
BoHung Chiu 2022-04-25 22:37:11 +08:00
parent 3fb9d052ac
commit 751f26c24c
2 changed files with 18 additions and 1 deletions

View File

@ -223,6 +223,11 @@ class SeminarMain
self.save(:validate=>false) if save_flag
end
end
after_destroy do
Thread.new do
Page.where(:bind_model=>self.class.to_s,:bind_uid=>self.uid).destroy
end
end
def self.time_range(date1 = null, date2 = null)
if !date1.blank?

View File

@ -1,5 +1,17 @@
Rails.application.routes.draw do
Thread.new do
if Page.fields.include?('all_pageids')
s = Site.first
if s.respond_to?(:tmp_flags) && !(s.tmp_flags.include?('fix_sr'))
Page.where(:bind_model=>"SeminarMain",:all_pageids=>nil).each do |p|
p.save
end
tmp_flags = s.tmp_flags
tmp_flags << 'fix_sr'
Site.update_all(:tmp_flags => tmp_flags)
end
end
end
locales = Site.first.in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do