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