Commit b29719e00d212cb90be368ef6ba92231d1f45983
1 parent
0e3803b1
Exists in
staging
and in
42 other branches
ActionItem65: populating anhetegua sample data
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@554 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
27 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +#!/usr/bin/env ruby | |
| 2 | +require File.dirname(__FILE__) + '/../config/environment' | |
| 3 | + | |
| 4 | +Environment.default.categories.destroy_all | |
| 5 | + | |
| 6 | +def new_category(parent, name, color = nil) | |
| 7 | + category = Environment.default.categories.build(:name => name, :display_color => color, :parent_id => (parent ? parent.id: nil)) | |
| 8 | + category.save! | |
| 9 | + category | |
| 10 | +end | |
| 11 | + | |
| 12 | +tematicas = new_category(nil, 'Temáticas', 1) | |
| 13 | +new_category(tematicas, 'Finanças Solidárias') | |
| 14 | +new_category(tematicas, 'Marco Legal') | |
| 15 | +new_category(tematicas, 'Software Livre') | |
| 16 | + | |
| 17 | +territorios = new_category(nil, 'Territórios', 2) | |
| 18 | +new_category(territorios, 'Bahia') | |
| 19 | +new_category(territorios, 'Distrito Federal') | |
| 20 | +new_category(territorios, 'Rio Grande do Sul') | |
| 21 | + | |
| 22 | +cadeias = new_category(nil, 'Cadeias', 3) | |
| 23 | +new_category(cadeias, 'Algodão') | |
| 24 | +new_category(cadeias, 'Tecnologia de Informação') | ... | ... |
script/populate
| ... | ... | @@ -5,3 +5,5 @@ User.create!(:login => 'testprofile', :email => 'admin@example.com', :password = |
| 5 | 5 | User.create!(:login => 'user', :email => 'user@example.com', :password => 'user', :password_confirmation => 'user') |
| 6 | 6 | User.create!(:login => 'usuario', :email => 'usuario@example.com', :password => 'usuario', :password_confirmation => 'usuario') |
| 7 | 7 | User.create!(:login => 'ze', :email => 'ze@example.com', :password => 'test', :password_confirmation => 'test') |
| 8 | + | |
| 9 | + | ... | ... |
script/reset_db