mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
awesome_nested_set: not use cache for max rgt (#6579)
git-svn-id: http://svn.redmine.org/redmine/trunk@13148 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -159,19 +159,11 @@ module CollectiveIdea #:nodoc:
|
|||||||
nested_set_scope.column_names.map(&:to_s).include?(depth_column_name.to_s)
|
nested_set_scope.column_names.map(&:to_s).include?(depth_column_name.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def right_most_node
|
|
||||||
@right_most_node ||= self.class.base_class.unscoped.nested_set_scope(
|
|
||||||
:order => "#{quoted_right_column_full_name} desc"
|
|
||||||
).first
|
|
||||||
end
|
|
||||||
|
|
||||||
def right_most_bound
|
def right_most_bound
|
||||||
@right_most_bound ||= begin
|
right_most_node =
|
||||||
return 0 if right_most_node.nil?
|
self.class.base_class.unscoped.
|
||||||
|
order("#{quoted_right_column_full_name} desc").limit(1).lock(true).first
|
||||||
right_most_node.lock!
|
right_most_node ? (right_most_node[right_column_name] || 0) : 0
|
||||||
right_most_node[right_column_name] || 0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_depth!
|
def set_depth!
|
||||||
|
|||||||
Reference in New Issue
Block a user