diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-28 13:00:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-28 13:00:16 +0000 |
commit | 1e3e23d756e0b365c42daa0c7d8a2a872db692e8 (patch) | |
tree | d1fa0b7d62fccc7f775f6427969a8ebbda98b950 | |
parent | 68d5af3dd8a6132e29e61f355481c1ceef86c412 (diff) | |
download | redmine-1e3e23d756e0b365c42daa0c7d8a2a872db692e8.tar.gz redmine-1e3e23d756e0b365c42daa0c7d8a2a872db692e8.zip |
RecordNotFound exception still raised with Rails3.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9569 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/query.rb | 2 | ||||
-rw-r--r-- | test/unit/query_test.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index e2e1326e2..0640dd684 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -564,7 +564,7 @@ class Query < ActiveRecord::Base r = nil if grouped? begin - # Rails will raise an (unexpected) RecordNotFound if there's only a nil group value + # Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value r = Issue.visible.count(:group => group_by_statement, :include => [:status, :project], :conditions => statement) rescue ActiveRecord::RecordNotFound r = {nil => issue_count} diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 8a39d09a1..c89c2c8c5 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -705,6 +705,16 @@ class QueryTest < ActiveSupport::TestCase assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq end + def test_issue_count_with_nil_group_only + Issue.update_all("assigned_to_id = NULL") + + q = Query.new(:name => '_', :group_by => 'assigned_to') + count_by_group = q.issue_count_by_group + assert_kind_of Hash, count_by_group + assert_equal 1, count_by_group.keys.size + assert_nil count_by_group.keys.first + end + def test_issue_ids q = Query.new(:name => '_') order = "issues.subject, issues.id" |