Modified: branches/component-api/config/initializers/default_content_types.rb (3588 => 3589)
--- branches/component-api/config/initializers/default_content_types.rb 2013-07-03 08:34:07 UTC (rev 3588)
+++ branches/component-api/config/initializers/default_content_types.rb 2013-07-08 12:38:50 UTC (rev 3589)
@@ -8,9 +8,11 @@
content_types = YAML::load_file("config/content_types.yml")
Rails.logger.debug('Loading content types...')
-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 #{v['title']}: #{v['mime_type']}")
- ContentType.create(v)
+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