FIX: Build broken when someone didn't have an embed category

This commit is contained in:
Robin Ward 2015-08-20 16:10:19 -04:00
parent 0dfeee8016
commit 676416f478
1 changed files with 6 additions and 2 deletions

View File

@ -6,10 +6,14 @@ class CreateEmbeddableHosts < ActiveRecord::Migration
t.timestamps
end
category_id = execute("SELECT c.id FROM categories AS c
category_id = 0;
category_row = execute("SELECT c.id FROM categories AS c
INNER JOIN site_settings AS s ON s.value = c.name
WHERE s.name = 'embed_category'")[0]['id'].to_i
WHERE s.name = 'embed_category'")
if category_row.cmd_tuples > 0
category_id = category_row[0]['id'].to_i
end
if category_id == 0
category_id = execute("SELECT value FROM site_settings WHERE name = 'uncategorized_category_id'")[0]['value'].to_i