##// END OF EJS Templates
awesome_nested_set: not use cache for max rgt (#6579)...
Toshi MARUYAMA -
r12873:cdf9cae4a2cf
parent child
Show More
@@ -159,19 +159,11 module CollectiveIdea #:nodoc:
159 159 nested_set_scope.column_names.map(&:to_s).include?(depth_column_name.to_s)
160 160 end
161 161
162 def right_most_node
163 @right_most_node ||= self.class.base_class.unscoped.nested_set_scope(
164 :order => "#{quoted_right_column_full_name} desc"
165 ).first
166 end
167
168 162 def right_most_bound
169 @right_most_bound ||= begin
170 return 0 if right_most_node.nil?
171
172 right_most_node.lock!
173 right_most_node[right_column_name] || 0
174 end
163 right_most_node =
164 self.class.base_class.unscoped.
165 order("#{quoted_right_column_full_name} desc").limit(1).lock(true).first
166 right_most_node ? (right_most_node[right_column_name] || 0) : 0
175 167 end
176 168
177 169 def set_depth!
General Comments 0
You need to be logged in to leave comments. Login now