Added: trunk/config/content_types.yml (0 => 3687)
--- trunk/config/content_types.yml (rev 0)
+++ trunk/config/content_types.yml 2013-09-06 13:45:29 UTC (rev 3687)
@@ -0,0 +1,4 @@
+component_profile:
+ title: Taverna Component Profile
+ mime_type: application/vnd.taverna.component-profile+xml
+ category: Blob
\ No newline at end of file
Added: trunk/config/initializers/default_content_types.rb (0 => 3687)
--- trunk/config/initializers/default_content_types.rb (rev 0)
+++ trunk/config/initializers/default_content_types.rb 2013-09-06 13:45:29 UTC (rev 3687)
@@ -0,0 +1,18 @@
+# myExperiment: config/initializers/content_types.rb
+#
+# Copyright (c) 2013 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+# Loads a set default content_types into the database
+
+content_types = YAML::load_file("config/content_types.yml")
+
+Rails.logger.debug('Loading content types...')
+ContentType.transaction do
+ content_types.each do |k,v|
+ unless ContentType.find_by_title_and_mime_type_and_category(v['title'], v['mime_type'], v['category'])
+ Rails.logger.debug("\tCreating content type #{v['title']}: #{v['mime_type']}")
+ ContentType.create(v)
+ end
+ end
+end