]> source.dussan.org Git - redmine.git/commitdiff
Fixed: ambiguous lft column SQL error on Issue#descendants with a join on projects.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 12 Apr 2011 16:31:00 +0000 (16:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 12 Apr 2011 16:31:00 +0000 (16:31 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5441 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/issue_test.rb
vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb

index 1049330896959a2511d75577e3d3dd51ac0698bd..ff98711a38a68db535e22e9f4941d7241f806495 100644 (file)
@@ -164,6 +164,10 @@ class IssueTest < ActiveSupport::TestCase
     assert_equal [], projects.select {|p| !p.is_or_is_descendant_of?(project)}
   end
   
+  def test_visible_and_nested_set_scopes
+    assert_equal 0, Issue.find(1).descendants.visible.all.size
+  end
+  
   def test_errors_full_messages_should_include_custom_fields_errors
     field = IssueCustomField.find_by_name('Database')
     
index b1e5ae1e75fbaec8bdba18a2c6252f3a3ebb767e..f46fb4335438a2f665711bcf5a8c3b62d41962b3 100644 (file)
@@ -425,7 +425,7 @@ module CollectiveIdea #:nodoc:
         # the base ActiveRecord class, using the :scope declared in the acts_as_nested_set
         # declaration.
         def nested_set_scope
-          options = {:order => quoted_left_column_name}
+          options = {:order => "#{self.class.table_name}.#{quoted_left_column_name}"}
           scopes = Array(acts_as_nested_set_options[:scope])
           options[:conditions] = scopes.inject({}) do |conditions,attr|
             conditions.merge attr => self[attr]