diff options
| author | hukl <contact@smyck.org> | 2009-11-15 14:47:18 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-11-15 14:47:18 +0100 |
| commit | 6d8a5755301cd12aa31f24543c8796da20dd53ba (patch) | |
| tree | e171765fb6081e8e00ed1eb0f3686f1c4a240014 /lib/tasks/development_init.rake | |
| parent | 1de97a5ac6f4621f8013d6f73c6c9edfae445b70 (diff) | |
rake task to set the update template on all updates
Diffstat (limited to 'lib/tasks/development_init.rake')
| -rw-r--r-- | lib/tasks/development_init.rake | 19 |
1 files changed, 19 insertions, 0 deletions
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 | |||
| 100 | 100 | ||
| 101 | end | 101 | end |
| 102 | 102 | ||
| 103 | desc "Change Update Templates from standard to update" | ||
| 104 | task :change_update_templates => :environment do |t| | ||
| 105 | Page.record_timestamps = false | ||
| 106 | Page.before_save.reject! {|filter| filter.method == :rewrite_links_in_body} | ||
| 107 | |||
| 108 | updates = (Node.find_by_unique_name("updates") || raise("No Update Node")) | ||
| 109 | |||
| 110 | years = updates.children | ||
| 111 | |||
| 112 | years.each do |year| | ||
| 113 | year.descendants.each do |update| | ||
| 114 | update.pages.each do |page| | ||
| 115 | page.template_name = "update" | ||
| 116 | page.save! | ||
| 117 | end | ||
| 118 | end | ||
| 119 | end | ||
| 120 | end | ||
| 121 | |||
| 103 | desc "Repair pages without published_at set" | 122 | desc "Repair pages without published_at set" |
| 104 | task :set_published_at => :environment do |t| | 123 | task :set_published_at => :environment do |t| |
| 105 | unpublished = Page.all(:conditions => {:published_at => nil}) | 124 | unpublished = Page.all(:conditions => {:published_at => nil}) |
