Commit a5e59178ebc8742f3fa089ac490abed0e24fd23e
Committed by
Thiago Ribeiro
1 parent
cec71c5b
Exists in
master
and in
2 other branches
Check if category exists on task create categories
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
lib/tasks/create_categories.rake
... | ... | @@ -6,8 +6,12 @@ namespace :software do |
6 | 6 | print 'Creating categories: ' |
7 | 7 | software = Category.create(:name => _("Software"), :environment => env) |
8 | 8 | Category::SOFTWARE_CATEGORIES.each do |category_name| |
9 | - print '.' | |
10 | - Category.create(:name => category_name, :environment => env, :parent => software) | |
9 | + unless Category.find_by_name(category_name) | |
10 | + print '.' | |
11 | + Category.create(:name => category_name, :environment => env, :parent => software) | |
12 | + else | |
13 | + print 'F' | |
14 | + end | |
11 | 15 | end |
12 | 16 | puts '' |
13 | 17 | end | ... | ... |