Modified: trunk/Rakefile (2889 => 2890)
--- trunk/Rakefile 2011-12-21 17:48:32 UTC (rev 2889)
+++ trunk/Rakefile 2012-01-04 11:50:17 UTC (rev 2890)
@@ -156,3 +156,23 @@
ActiveRecord::Base.record_timestamps = true
end
+desc 'Assign categories to content types'
+task "myexp:types:assign_categories" do
+ require File.dirname(__FILE__) + '/config/environment'
+
+ workflow_content_types = Workflow.find(:all).group_by do |w| w.content_type_id end.keys
+
+ ContentType.find(:all).each do |content_type|
+
+ next if content_type.category
+
+ if workflow_content_types.include?(content_type.id)
+ category = "Workflow"
+ else
+ category = "Blob"
+ end
+
+ content_type.update_attribute("category", category)
+ end
+end
+