Add data migration for search widget for news and announcement.

This commit is contained in:
Matthew K. Fu JuYuan 2012-07-20 16:30:43 +08:00
parent f9bdb4a327
commit 834fcddc52
1 changed files with 10 additions and 0 deletions

View File

@ -19,4 +19,14 @@ namespace :data_migration do
NewsBulletinCategory.all.each{|bc| bc.disable=false;bc.save!} NewsBulletinCategory.all.each{|bc| bc.disable=false;bc.save!}
end end
task :add_search_widget_to_news_and_announcement => :environment do
app = ModuleApp.first({:conditions=>{:title => 'news'}})
app.widgets << "bulletins_search_block" if app.widgets.include?("bulletins_search_block")
app.save!
app = ModuleApp.first({:conditions=>{:title => 'Announcement'}})
app.widgets << "news_bulletins_search_block" if app.widgets.include?("news_bulletins_search_block")
app.save!
p "==DO NOT FORGET TO RUN: rake redis_search:index"
end
end end