diff --git a/app/models/seminar_main.rb b/app/models/seminar_main.rb index fd41361..e50db84 100644 --- a/app/models/seminar_main.rb +++ b/app/models/seminar_main.rb @@ -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? diff --git a/config/routes.rb b/config/routes.rb index d8902b3..78e33d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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