summaryrefslogtreecommitdiffstats
path: root/lib/plugins
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-03-26 01:47:48 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-03-26 01:47:48 +0000
commit3c83d1c6464019dd0e1c8c0ca08798bb8570a6e0 (patch)
tree9948cf3a9d15813dc0597e7249e7786a85aea0b1 /lib/plugins
parente4cf210fa24ebe134d38a977270a1ebf150a90e8 (diff)
downloadredmine-3c83d1c6464019dd0e1c8c0ca08798bb8570a6e0.tar.gz
redmine-3c83d1c6464019dd0e1c8c0ca08798bb8570a6e0.zip
fix always new lft and rgt are lft = 1, rgt = 2 (#6579)
git-svn-id: http://svn.redmine.org/redmine/trunk@13009 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb
index c831c48fc..259de5a08 100644
--- a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb
+++ b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb
@@ -540,7 +540,9 @@ module CollectiveIdea #:nodoc:
# on creation, set automatically lft and rgt to the end of the tree
def set_default_left_and_right
- highest_right_row = nested_set_scope(:order => "#{quoted_right_column_full_name} desc").limit(1).lock(true).first
+ highest_right_row =
+ self.class.base_class.unscoped.
+ order("#{quoted_right_column_full_name} desc").limit(1).lock(true).first
maxright = highest_right_row ? (highest_right_row[right_column_name] || 0) : 0
# adds the new node to the right of all existing nodes
self[left_column_name] = maxright + 1