Modified: trunk/config/initializers/default_content_types.rb (3703 => 3704)
--- trunk/config/initializers/default_content_types.rb 2013-09-11 09:27:32 UTC (rev 3703)
+++ trunk/config/initializers/default_content_types.rb 2013-09-11 11:13:15 UTC (rev 3704)
@@ -5,14 +5,16 @@
# Loads a set default content_types into the database
-content_types = YAML::load_file("config/content_types.yml")
+if ActiveRecord::Base.connection.table_exists?('content_types')
+ 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)
+ 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
end