From 6d8a5755301cd12aa31f24543c8796da20dd53ba Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 15 Nov 2009 14:47:18 +0100 Subject: rake task to set the update template on all updates --- lib/tasks/development_init.rake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/tasks/development_init.rake b/lib/tasks/development_init.rake index 1e9223d..2ac9a83 100644 --- a/lib/tasks/development_init.rake +++ b/lib/tasks/development_init.rake @@ -100,6 +100,25 @@ namespace :cccms do end + desc "Change Update Templates from standard to update" + task :change_update_templates => :environment do |t| + Page.record_timestamps = false + Page.before_save.reject! {|filter| filter.method == :rewrite_links_in_body} + + updates = (Node.find_by_unique_name("updates") || raise("No Update Node")) + + years = updates.children + + years.each do |year| + year.descendants.each do |update| + update.pages.each do |page| + page.template_name = "update" + page.save! + end + end + end + end + desc "Repair pages without published_at set" task :set_published_at => :environment do |t| unpublished = Page.all(:conditions => {:published_at => nil}) -- cgit v1.3