@@ -56,7 +56,7 class Project < ActiveRecord::Base | |||||
56 | :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", |
|
56 | :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", | |
57 | :association_foreign_key => 'custom_field_id' |
|
57 | :association_foreign_key => 'custom_field_id' | |
58 |
|
58 | |||
59 | acts_as_nested_set :order => 'name', :dependent => :destroy |
|
59 | acts_as_nested_set :order_column => 'name', :dependent => :destroy | |
60 | acts_as_attachable :view_permission => :view_files, |
|
60 | acts_as_attachable :view_permission => :view_files, | |
61 | :delete_permission => :manage_files |
|
61 | :delete_permission => :manage_files | |
62 |
|
62 |
@@ -198,17 +198,16 module CollectiveIdea #:nodoc: | |||||
198 | # set left |
|
198 | # set left | |
199 | node[left_column_name] = indices[scope.call(node)] += 1 |
|
199 | node[left_column_name] = indices[scope.call(node)] += 1 | |
200 | # find |
|
200 | # find | |
201 | where(["#{quoted_parent_column_name} = ? #{scope.call(node)}", node]). |
|
201 | where(["#{quoted_parent_column_full_name} = ? #{scope.call(node)}", node]).order("#{quoted_left_column_full_name}, #{quoted_right_column_full_name}, id").each{|n| set_left_and_rights.call(n) } | |
202 | order(acts_as_nested_set_options[:order]). |
|
|||
203 | each{|n| set_left_and_rights.call(n) } |
|
|||
204 | # set right |
|
202 | # set right | |
205 | node[right_column_name] = indices[scope.call(node)] += 1 |
|
203 | node[right_column_name] = indices[scope.call(node)] += 1 | |
206 | node.save!(:validate => validate_nodes) |
|
204 | node.save!(:validate => validate_nodes) | |
207 | end |
|
205 | end | |
208 |
|
206 | |||
209 | # Find root node(s) |
|
207 | # Find root node(s) | |
210 | root_nodes = where("#{quoted_parent_column_name} IS NULL"). |
|
208 | root_nodes = where("#{quoted_parent_column_full_name} IS NULL"). | |
211 |
order(acts_as_nested_set_options[:order]). |
|
209 | order(acts_as_nested_set_options[:order_column]). | |
|
210 | each do |root_node| | |||
212 | # setup index for this scope |
|
211 | # setup index for this scope | |
213 | indices[scope.call(root_node)] ||= 0 |
|
212 | indices[scope.call(root_node)] ||= 0 | |
214 | set_left_and_rights.call(root_node) |
|
213 | set_left_and_rights.call(root_node) |
General Comments 0
You need to be logged in to leave comments.
Login now