diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-03 20:55:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-03 20:55:04 +0000 |
commit | a7023dfa9b8e39e6e0a73e57d22823e8a4260b71 (patch) | |
tree | 4b465df28ede45f9f17416baf1076dd52f4c2fc9 /lib/plugins/awesome_nested_set | |
parent | 738cf2e187f90cd7273ae0de610bfea49b4b799f (diff) | |
download | redmine-a7023dfa9b8e39e6e0a73e57d22823e8a4260b71.tar.gz redmine-a7023dfa9b8e39e6e0a73e57d22823e8a4260b71.zip |
Replaces find(:first) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10930 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins/awesome_nested_set')
-rw-r--r-- | lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb | 12 |
1 files changed, 6 insertions, 6 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 95d9494d4..7f0b23197 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 @@ -413,7 +413,7 @@ 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_name} desc").find(:first, :limit => 1,:lock => true ) + highest_right_row = nested_set_scope(:order => "#{quoted_right_column_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 @@ -443,11 +443,11 @@ module CollectiveIdea #:nodoc: in_tenacious_transaction do reload_nested_set # select the rows in the model that extend past the deletion point and apply a lock - self.class.base_class.find(:all, - :select => "id", - :conditions => ["#{quoted_left_column_name} >= ?", left], - :lock => true - ) + self.class.base_class. + select("id"). + where("#{quoted_left_column_name} >= ?", left). + lock(true). + all if acts_as_nested_set_options[:dependent] == :destroy descendants.each do |model| |