help find the error
def import_categories
puts "", "importing categories..."
categories = mysql_query("
SELECT id,
name_seo name_seo,
parent_id as parent_id
FROM #{FORUMS_TABLE}
ORDER BY parent_id ASC
").to_a
top_level_categories = categories.select { |c| c["parent.id"] == -1 }
create_categories(top_level_categories) do |category|
id = category['id'].to_s
name_seo = category['name']
{
id: id,
name_seo: name,
}
end
children_categories = categories.select { |c| c["parent.id"] != -1 }
create_categories(children_categories) do |category|
id = category['id'].to_s
name_seo = category['name']
{
id: id,
name_seo: name,
parent_category_id: @lookup.category_id_from_imported_category_id(category['parent_id']),
color: random_category_color
}
end
end