@@ -159,19 +159,11 module CollectiveIdea #:nodoc: | |||||
159 | nested_set_scope.column_names.map(&:to_s).include?(depth_column_name.to_s) |
|
159 | nested_set_scope.column_names.map(&:to_s).include?(depth_column_name.to_s) | |
160 | end |
|
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 | def right_most_bound |
|
162 | def right_most_bound | |
169 |
|
|
163 | right_most_node = | |
170 | return 0 if right_most_node.nil? |
|
164 | self.class.base_class.unscoped. | |
171 |
|
165 | order("#{quoted_right_column_full_name} desc").limit(1).lock(true).first | ||
172 | right_most_node.lock! |
|
166 | right_most_node ? (right_most_node[right_column_name] || 0) : 0 | |
173 | right_most_node[right_column_name] || 0 |
|
|||
174 | end |
|
|||
175 | end |
|
167 | end | |
176 |
|
168 | |||
177 | def set_depth! |
|
169 | def set_depth! |
General Comments 0
You need to be logged in to leave comments.
Login now