Changeset 492

Show
Ignore:
Timestamp:
01/25/07 01:16:47 (2 years ago)
Author:
jarmo
Message:
  • Removed the tree hierarchy from form categories.
  • Cleaned the FormCategoryController.
  • Cleaned the functional tests for form categories.
  • Removed all but one form category from the fixtures.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/form_system_263/app/controllers/application.rb

    r488 r492  
    196196  # 
    197197  # Parameters: 
    198   # model_class    - The class object of the model whose instance is created. 
    199   # name_attribute - The name of the attribute of the model instance that returns 
    200   #                  the instance's name (written to log). 
    201   def common_create(model_class, name_attribute='name', redirect={:action => 'index'}, cancel_url_options={:action => 'index'}, partial_to_render='shared/create_or_edit') 
     198  # model_class        - The class object of the model whose instance is created. 
     199  # name_attribute     - The name of the attribute of the model instance that returns 
     200  #                      the instance's name (written to log). 
     201  # redirect           - Redirection after succesful creation. 
     202  # cancel_url_options - Redirection after cancel. 
     203  # partial_to_render  - Partial to render with.  
     204  def common_create(model_class, name_attribute='name', redirect={:action => 'list'}, cancel_url_options={:action => 'list'}, partial_to_render='shared/create_or_edit') 
    202205    if request.post? 
    203206      @model = model_class.create(params[:model]) 
     
    226229  # name_attribute - The name of the attribute of the model instance that returns 
    227230  #                  the instance's name. 
    228   def common_edit(model_class, name_attribute='name', redirect={:action => 'index'}, cancel_url_options={:action => 'index'}, partial_to_render='shared/create_or_edit') 
     231  # redirect           - Redirection after succesful modification. 
     232  # cancel_url_options - Redirection after cancel. 
     233  # partial_to_render  - Partial to render with. 
     234  def common_edit(model_class, name_attribute='name', redirect={:action => 'list'}, cancel_url_options={:action => 'list'}, partial_to_render='shared/create_or_edit') 
    229235    @model = model_class.find(params[:id]) 
    230236 
     
    256262  # name_attribute - The name of the attribute of the model instance that returns 
    257263  #                  the instance's name (written to log). 
    258   def common_remove(model_class, name_attribute='name', redirect={:action => 'index'}) 
     264  # redirect       - Passed to redirect_to. 
     265  def common_remove(model_class, name_attribute='name', redirect={:action => 'list'}) 
    259266    redirect_to redirect 
    260267 
  • branches/form_system_263/app/controllers/form_category_controller.rb

    r488 r492  
    1313 
    1414  def list 
    15     @help = 'general' 
    1615    @title = _('Form categories') 
    17     @fields = [ [_('Name'), :name], 
    18                 [_('Parent'), :parent_name], 
    19                 [_('Tag'), :form_tag], 
     16 
     17    @fields = [  
     18                [_('Name'), :name, 'name'], 
     19                [_('Tag'), :form_tag, 'form_tag_id'], 
    2020                [_('Form type count'), :form_type_count] 
    2121              ] 
    22     @items = items_for_page(FormCategory, :order => 'parent_id, form_tag_id, name') 
     22 
     23    @items = items_for_page(FormCategory) 
    2324    render(:partial => 'shared/list_items', :layout => 'mainlevel') 
    2425  end 
    2526 
    2627  def create 
    27     @help = 'general' 
    2828    @title = _('Create a new form category') 
     29 
     30    form_tag_options = FormTag.find(:all, :order => 'name').map {|t| [t.full_name, t.id] } 
    2931    @fields = [ 
    30                 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 }], 
    31                 [_('Tag'), :select, 'form_tag_id', FormTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
    32                 [_('Parent'), :select, 'parent_id' ] 
     32                [_('Name'), :text_field, 'name', {:size => 40, :maxlength => 40}], 
     33                [_('Tag'), :select, 'form_tag_id', form_tag_options, {:include_blank => true}], 
    3334              ] 
    34     update_possible_parents() 
    35     common_create(FormCategory, 'name', {:action => 'list'}, {:action => 'list'}
     35 
     36    common_create(FormCategory
    3637  end 
    3738 
    3839  def edit 
    39     @help = 'general' 
    40     @title = _('Edit form category') 
     40    @title = _('Edit form category')  
     41 
    4142    @form_category = FormCategory.find params[:id] 
     43    form_tag_options = FormTag.find(:all, :order => 'name').map {|t| [t.full_name, t.id] } 
    4244    @fields = [ 
    4345                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 }], 
    44                 [_('Tag'), :select, 'form_tag_id', FormTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
    45                 [_('Parent'), :select, 'parent_id' ] 
     46                [_('Tag'), :select, 'form_tag_id', form_tag_options, { :include_blank => true } ], 
    4647              ] 
    47     update_possible_parents(@form_category) 
    48     common_edit(FormCategory, 'name', {:action => 'list'}, {:action => 'list'}
     48 
     49    common_edit(FormCategory
    4950  end 
    5051 
    5152  def remove 
    52     common_remove(FormCategory, 'name', :action => 'list')  {|instance| 
    53       unless instance.children.empty? and instance.form_types.empty? 
     53    common_remove(FormCategory)  {|instance| 
     54      unless instance.form_types.empty? 
    5455        msg_could_not_remove_because_not_empty(instance) 
    5556      end 
    5657    } 
    5758  end 
    58  
    59   def view_as_tree 
    60     @help = 'general' 
    61     @title = ('Form category hierarchy') 
    62     @form_categories = FormCategory.find :all, :readonly => true, :order => 'name' 
    63   end 
    64  
    65 private 
    66  
    67   # Function: update_possible_parents 
    68   # ================================= 
    69   # 
    70   # Updates possible parents for the form_category. 
    71   # 
    72   # If no form_category is given, then the list of 
    73   # possible parents will contain all existing categories. 
    74   def update_possible_parents(form_category = nil) 
    75     form_categories = FormCategory.find(:all, :order => 'name') 
    76     possible_parents = [[_('No parent'), 0]] 
    77  
    78     form_categories.each do |potential_parent| 
    79       unless potential_parent.is_child_of?(form_category) or potential_parent == form_category 
    80         possible_parents << [potential_parent.name, potential_parent.id] 
    81       end 
    82     end 
    83     # Options for parent select 
    84     @fields.last[3] = possible_parents 
    85   end 
    8659end 
  • branches/form_system_263/app/models/form_category.rb

    r488 r492  
    88  validates_presence_of :name 
    99  validates_uniqueness_of :name 
    10   validates_length_of :name, :within => 4..40 
    1110  # Callbacks 
    1211  before_destroy :check_empty 
    1312  # Associations 
    14   acts_as_tree :order => 'name' 
    1513  belongs_to :form_tag 
    1614  has_many :form_types, :order => 'name' 
    1715   
    1816  exports_automatic_field 'cmms_form_category_name', :string, :name 
    19  
    20  
    21   def is_child_of?(potential_parent) 
    22     return false if potential_parent == nil 
    23     return false if potential_parent == self 
    24  
    25     current_node = self 
    26  
    27     while true 
    28       current_node = current_node.parent 
    29       return true if current_node == potential_parent 
    30       return false if current_node == nil 
    31     end 
    32   end 
    33  
    34   # Returns the parent category's name, or +nil+ if the 
    35   # category doesn't have a parent. 
    36   def parent_name 
    37     self.parent.name if self.parent 
    38   end 
    3917 
    4018  # Returns the number of form types in this form category 
     
    4725  # Prevents destroing categories with children or form types 
    4826  def check_empty 
    49     return true if self.children.empty? and self.form_types.empty? 
     27    return true if self.form_types.empty? 
    5028    return false 
    5129  end 
  • branches/form_system_263/config/menu.rb

    r488 r492  
    117117                    MenuButton.new(_('Form categories'), '22x22/menu_form_category.gif', 
    118118                      MenuItem.new(_('List'), 'form_category', 'list', '16x16/list.gif'), 
    119                       MenuItem.new(_('Tree'), 'form_category', 'view_as_tree', '16x16/view_tree.gif'), 
    120119                      MenuItem.new(_('Create'), 'form_category', 'create', '16x16/create.gif'), 
    121120                      Page.new('form_category', 'edit') 
  • branches/form_system_263/db/migrate/021_version_one_dot_two_tables.rb

    r488 r492  
    144144    add_index 'form_template_images', ['form_type_id'] 
    145145    # If faster image quering is needed try indexing the name columns too! 
     146 
     147    # Form system changes 
     148    # Remove the tree structure of the form categories 
     149    remove_column 'form_categories', 'parent_id' 
    146150  end 
    147151 
     
    170174 
    171175    rename_action_keys(true) 
     176 
     177    # FIXME: Add the form_categories column 
    172178  end 
    173179 
  • branches/form_system_263/db/migrate/022_version_one_dot_two_data.rb

    r488 r492  
    3333      key 
    3434    } 
     35 
     36    # Remove action keys 
     37    names_of_removed_action_keys = [ 'form_category/view_as_tree' ] 
     38    for name in names_of_removed_action_keys 
     39      begin 
     40        TempActionKey.find_by_name(name).destroy 
     41      rescue 
     42        # Do nothing 
     43      end 
     44    end 
    3545  end 
    3646 
  • branches/form_system_263/test/fixtures/form_categories.yml

    r488 r492  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22 
    3 category1: 
     3# FIXME: We should get rid of this 
     4 
     5test_form_category: 
    46  id: 1 
    5   name: plans 
    6   parent_id: 0 
    7  
    8 category2: 
    9   id: 2 
    10   name: notices 
    11   parent_id: 1 
    12  
    13 unauthorized: 
    14   id: 5 
    15   name: unauthorized 
    16   parent_id: 0 
    17  
    18 category_created_by_admin: 
    19   id: 3 
    20   name: "admin category" 
    21   parent_id: 0 
    22  
    23 category_created_by_other_admin: 
    24   id: 4 
    25   name: "admin category" 
    26   parent_id: 3 
    27  
    28 category_created_by_yet_another_admin: 
    29   id: 6 
    30   name: "another admin category" 
    31   parent_id: 4 
    32  
    33 invalid_forms: 
    34   id: 7 
    35   name: 'valid and invalid forms' 
    36   parent_id: 0 
    37  
    38 # test_is_child_of 
    39 #   root 
    40 #  a1  a2 
    41 #     b1 b2 
    42  
    43 root: 
    44   id: 8 
    45   name: root 
    46   parent_id: 0 
    47  
    48 a1: 
    49   id: 9 
    50   name: a1 
    51   parent_id: 8 
    52  
    53 a2: 
    54   id: 10 
    55   name: a2 
    56   parent_id: 8 
    57  
    58 b1: 
    59   id: 11 
    60   name: b1 
    61   parent_id: 10 
    62  
    63 b2: 
    64   id: 12 
    65   name: b2 
    66   parent_id: 10 
    67  
    68  
    69 # ID SPACE 100 - 199 
    70 # functional/admin_controller_test.rb 
    71 category_with_form_types: 
    72   id: 100 
    73   name: 'I have form types' 
    74   parent_id: 0  
    75  
    76 # ID SPACE 200 - 299 
    77 # unit/form_test.rb 
    78 form_test_category: 
    79   id: 200 
    80   name: 'For form tests' 
    81   parent_id: 0  
    82  
    83 # ID SPACE 300 - 399 
    84 # functional/main_controller_test.rb 
    85 special_chars_category: 
    86   id: 300 
    87   name: 'For special form types' 
    88   parent_id: 0 
    89  
    90 # ID SPACE 400 - 499 
    91 # test/functional/form_category_controller_test.rb 
    92 should_get_deleted1: 
    93   id: 400 
    94   name: 'Should get deleted 1' 
    95   parent_id: 0 
    96  
    97 should_get_deleted2: 
    98   id: 401 
    99   name: 'Should get deleted 2' 
    100   parent_id: 0 
     7  name: "We should not use fixtures!" 
  • branches/form_system_263/test/fixtures/form_types.yml

    r488 r492  
    1414removable1: 
    1515  id: 101 
    16   form_category_id: 100 
     16  form_category_id: 1 
    1717  name: 'Me ready. Me no forms have.' 
    1818  ready: true 
    1919removable2: 
    2020  id: 102 
    21   form_category_id: 100 
     21  form_category_id: 1 
    2222  name: 'Me ready. Me no forms have.' 
    2323  ready: true 
    2424removable3: 
    2525  id: 103 
    26   form_category_id: 100 
     26  form_category_id: 1 
    2727  name: 'Me ready. Me no forms have.' 
    2828  ready: true 
    2929ready_with_forms: 
    3030  id: 104 
    31   form_category_id: 100 
     31  form_category_id: 1 
    3232  name: 'Me ready. Me many repots have.' 
    3333  ready: true 
     
    3838form_type_with_all_user_field_types: 
    3939  id: 200 
    40   form_category_id: 200 
     40  form_category_id: 1 
    4141  name: 'I have all user field types' 
    4242  editable: true 
     
    4747form_type_for_special_chars_forms: 
    4848  id: 300 
    49   form_category_id: 300  
     49  form_category_id: 1 
    5050  name: "I'm special" 
    5151  form_category_id: 1 
     
    5757invalid_and_valid_forms: 
    5858  id: 400 
    59   form_category_id: 7 
     59  form_category_id: 1 
    6060  name: 'Invalid and valid forms' 
    6161 
     
    7474#  id: 2 
    7575#  name: urgent notices 
    76 #  form_category_id: 2 
     76#  form_category_id: 1 
    7777# 
    7878#odt_forms: 
     
    111111#  id: 10 
    112112#  name: 'Has a ready and a not ready form' 
    113 #  form_category_id: 7 
     113#  form_category_id: 1 
    114114# 
  • branches/form_system_263/test/functional/form_category_controller_test.rb

    r488 r492  
    66 
    77class FormCategoryControllerTest < Test::Unit::TestCase 
    8   fixtures :users, :keyrings, :keyrings_users, :action_keys, :action_keys_keyrings, 
    9            :form_categories, :assets, :assets_user_groups, :user_groups, 
    10            :user_groups_users, :form_types 
    11  
    128  def setup 
    139    @controller = FormCategoryController.new 
    1410    @request    = ActionController::TestRequest.new 
    1511    @response   = ActionController::TestResponse.new 
    16     login() 
     12   
     13    simple_setup_for_functional_test 
     14     
     15    # Add keys 
     16    @keyring.action_keys << create_action_key('form_category/list') 
     17    @keyring.action_keys << create_action_key('form_category/create') 
     18    @keyring.action_keys << create_action_key('form_category/edit') 
     19    @keyring.action_keys << create_action_key('form_category/remove') 
    1720  end 
    1821 
    19   def test_index 
    20     user = @request.session[:user] 
     22  def test_list 
     23    FormCategory.create!(:name => 'Category 1')  
     24    FormCategory.create!(:name => 'Category 2')  
     25    FormCategory.create!(:name => 'Category 3')  
    2126 
    2227    get 'list' 
    2328    assert_response :success 
    24     categories = FormCategory.find :all, :order => 'parent_id, name' 
    25     assert_equal categories, assigns(:items) 
    26   end 
    2729 
    28   def test_view_as_tree 
    29     user = @request.session[:user] 
    30  
    31     get 'view_as_tree' 
    32     assert_response :success 
    33     categories = FormCategory.find :all, :order => 'name' 
    34     assert_equal categories, assigns(:form_categories) 
     30    assert_equal false, assigns(:items).empty? 
    3531  end 
    3632 
     
    4036 
    4137    post 'create', :model => {'name' => new_category, 'form_tag_id' => form_tag.id} 
     38    assert_response :redirect 
     39    assert_redirected_to :action => 'list' 
    4240 
    43     assert_redirected_to :action => 'list' 
    4441    category = FormCategory.find_by_name new_category 
    45     assert_kind_of FormCategory, category 
    4642    assert_equal new_category, category.name 
    4743    assert_equal form_tag, category.form_tag 
     
    5349  # Checks that the +remove+ action does not remove anything if called via GET 
    5450  def test_remove_with_get 
    55     category = FormCategory.find @form_categories['should_get_deleted1']['id'] 
    56     get 'remove', :delete => {category.id=>1} 
     51    category = FormCategory.create!(:name => "Won't be removed")  
     52    get 'remove', :delete => {category.id => 1} 
    5753 
    5854    assert_response :redirect 
     
    7975  # Checks that the +remove+ action removes categories if called via POST 
    8076  def test_remove_post 
    81     category1 = FormCategory.find @form_categories['should_get_deleted1']['id'] 
    82     category2 = FormCategory.find @form_categories['should_get_deleted2']['id'] 
     77    category1 = FormCategory.create!(:name => 'should_get_deleted1') 
     78    category2 = FormCategory.create!(:name => 'should_get_deleted2') 
    8379 
    8480    post 'remove', :delete => {category1.id=>1, category2.id=>1} 
     
    9692 
    9793  def test_remove_category_containing_form_types 
    98     category1 = FormCategory.find @form_categories['category_with_form_types']['id'] 
    99     category2 = FormCategory.find @form_categories['should_get_deleted1']['id'] 
    100     category3 = FormCategory.find @form_categories['should_get_deleted2']['id'] 
     94    category1 = FormCategory.create!(:name => 'should_get_deleted1') 
     95    category2 = FormCategory.create!(:name => 'category_with_form_types') 
     96    category3 = FormCategory.create!(:name => 'should_get_deleted2') 
     97 
     98    category2.form_types << FormType.create!(:name => 'new form type') 
    10199 
    102100    post 'remove', :delete => {category1.id=>1, category2.id=>1, category3.id=>1} 
     
    104102    assert_redirected_to :action => 'list' 
    105103 
    106     # The first category has subcategories, so it should not be deleted. 
    107     assert_equal category1, FormCategory.find(category1.id) 
    108     assert_raise(ActiveRecord::RecordNotFound) {FormCategory.find category2.id} 
     104    # The second category has subcategories, so it should not be deleted. 
     105    assert_raise(ActiveRecord::RecordNotFound) {FormCategory.find category1.id} 
     106    assert_equal category2, FormCategory.find(category2.id) 
    109107    assert_raise(ActiveRecord::RecordNotFound) {FormCategory.find category3.id} 
    110108 
     
    120118  # Checks that we don't get an empty notice message when nothing gets removed. 
    121119  def test_remove_nothing_doesnt_show_empty_notice 
    122     category1 = FormCategory.find @form_categories['category_with_form_types']['id'] 
     120    category1 = FormCategory.create!(:name => 'category_with_form_types') 
     121    category1.form_types << FormType.create!(:name => 'new form type') 
    123122 
    124123    post 'remove', :delete => {category1.id=>1} 
     
    138137 
    139138  def test_edit 
    140     category_id = @form_categories['category_created_by_admin']['id'] 
     139    category = FormCategory.create!(:name => 'original name') 
     140    new_name = 'new name' 
     141     
    141142    # New attributes (shouldn't match the old ones) 
    142     new_name = "The new name for the category" 
     143    assert_not_equal new_name, category.name 
    143144 
    144     post 'edit', :id => category_id, :model => {"name" => new_name} 
     145    post 'edit', :id => category.id, :model => {"name" => new_name} 
    145146 
    146     assert_equal new_name, FormCategory.find(category_id).name 
     147    assert_equal new_name, FormCategory.find(category.id).name 
    147148 
    148149    assert_not_nil flash[:notice] 
  • branches/form_system_263/test/functional/form_type_controller_test.rb

    r488 r492  
    3737  def test_create_form_type_successfully 
    3838    login() 
    39     form_category_id = @form_categories['category_with_form_types']['id'] 
     39    form_category_id = FormCategory.create!(:name => 'test category').id 
    4040 
    4141    # GET step1 
  • branches/form_system_263/test/test_helper.rb

    r488 r492  
    3737 
    3838  # Add more helper methods to be used by all tests here... 
     39   
     40  # Creates an asset, a user, a user group and a keyring. 
     41  # Also sets the @ref_url and @request.env['HTTP_REFERER']. 
     42  def simple_setup_for_functional_test 
     43    # If the action should "redirect_to :back" then  
     44    # "assert_redirected_to @ref_url" can be used to check. 
     45    @ref_url = 'http://test.host/redirect/back' 
     46    @request.env['HTTP_REFERER'] = @ref_url 
     47     
     48    @user_group = create_user_group('test') 
     49    @keyring = create_keyring('test') 
     50    @user = create_user('test') 
     51    @user_group.users << @user 
     52    @keyring.users << @user 
     53    login('test') 
     54 
     55    # Create the root asset and give @user_group all permissions to it 
     56    @root = create_root_asset('Root', 'ROOT') 
     57    add_user_group_to_asset(@user_group, @root, true, true, true, true, true, true, true) 
     58  end 
    3959 
    4060  # In tests call login(args) or login_user() to log in as  
  • branches/form_system_263/test/unit/form_category_test.rb

    r488 r492  
    33class FormCategoryTest < Test::Unit::TestCase 
    44 
    5   # Checks that +FormCategory#is_child_of+ works. 
    6   def test_is_child_of 
    7     # Setup 
    8     create_categories 
    9  
    10     assert_equal false, @b1.is_child_of?(nil) 
    11     assert_equal false, @b1.is_child_of?(@b1) 
    12     assert_equal true, @b1.is_child_of?(@a2) 
    13     assert_equal true, @b1.is_child_of?(@root) 
    14     assert_equal false, @b1.is_child_of?(@b2) 
    15     assert_equal false, @b1.is_child_of?(@a1) 
    16  
    17     assert_equal false, @b2.is_child_of?(nil) 
    18     assert_equal false, @b2.is_child_of?(@b2) 
    19     assert_equal true, @b2.is_child_of?(@a2) 
    20     assert_equal true, @b2.is_child_of?(@root) 
    21     assert_equal false, @b2.is_child_of?(@b1) 
    22     assert_equal false, @b2.is_child_of?(@a1) 
    23  
    24     assert_equal false, @a1.is_child_of?(nil) 
    25     assert_equal false, @a1.is_child_of?(@a1) 
    26     assert_equal true, @a1.is_child_of?(@root) 
    27     assert_equal false, @a1.is_child_of?(@a2) 
    28     assert_equal false, @a1.is_child_of?(@b1) 
    29     assert_equal false, @a1.is_child_of?(@b2) 
    30  
    31     assert_equal false, @a2.is_child_of?(nil) 
    32     assert_equal false, @a2.is_child_of?(@a2) 
    33     assert_equal true, @a2.is_child_of?(@root) 
    34     assert_equal false, @a2.is_child_of?(@a1) 
    35     assert_equal false, @a2.is_child_of?(@b1) 
    36     assert_equal false, @a2.is_child_of?(@b2) 
    37  
    38     assert_equal false, @root.is_child_of?(nil) 
    39     assert_equal false, @root.is_child_of?(@root) 
    40     assert_equal false, @root.is_child_of?(@a1) 
    41     assert_equal false, @root.is_child_of?(@a2) 
    42     assert_equal false, @root.is_child_of?(@b1) 
    43     assert_equal false, @root.is_child_of?(@b2) 
    44   end 
    45  
    46   # Checks that +FormCategory#parent_name+ works. 
    47   def test_parent_name 
    48     # Setup 
    49     create_categories 
    50  
    51     assert_equal nil, @root.parent_name 
    52     assert_equal 'root', @a1.parent_name 
    53     assert_equal 'root_a2', @b1.parent_name 
    54   end 
    55  
    565  # Checks that categories with children or form types can't be destroyed 
    576  def test_check_empty 
    587    category = FormCategory.create!(:name => 'test') 
    59     child = FormCategory.create!(:name => 'test child', :parent_id => category.id) 
    60  
    61     assert_equal false, category.destroy 
    62     assert_equal [child], category.children(true) 
    638 
    649    form_type = FormType.create!(:name => 'test', :form_category_id => category.id) 
    65     assert_equal false, category.destroy 
    66     assert_equal [child], category.children(true) 
    67     assert_equal [form_type], category.form_types(true) 
    68  
    69     category.children.clear 
    7010    assert_equal false, category.destroy 
    7111    assert_equal [form_type], category.form_types(true) 
     
    7313    category.form_types.clear 
    7414    category.destroy 
     15 
    7516    assert_raise(ActiveRecord::RecordNotFound) { FormCategory.find category.id } 
    7617  end 
    77  
    78   private 
    79  
    80   def create_categories 
    81     @root = FormCategory.create(:name => 'root') 
    82     @a1 = FormCategory.create!(:name => 'root_a1', :parent => @root) 
    83     @a2 = FormCategory.create!(:name => 'root_a2', :parent => @root) 
    84     @b1 = FormCategory.create!(:name => 'root_a2_b1', :parent => @a2) 
    85     @b2 = FormCategory.create!(:name => 'root_a2_b2', :parent => @a2) 
    86   end 
    8718end 

© 2004-2007 Norfello Oy All Rights Reserved