RecordNotFound exception still raised with Rails3.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9569 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
68d5af3dd8
commit
1e3e23d756
|
@ -564,7 +564,7 @@ class Query < ActiveRecord::Base
|
||||||
r = nil
|
r = nil
|
||||||
if grouped?
|
if grouped?
|
||||||
begin
|
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)
|
r = Issue.visible.count(:group => group_by_statement, :include => [:status, :project], :conditions => statement)
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
r = {nil => issue_count}
|
r = {nil => issue_count}
|
||||||
|
|
|
@ -705,6 +705,16 @@ class QueryTest < ActiveSupport::TestCase
|
||||||
assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq
|
assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq
|
||||||
end
|
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
|
def test_issue_ids
|
||||||
q = Query.new(:name => '_')
|
q = Query.new(:name => '_')
|
||||||
order = "issues.subject, issues.id"
|
order = "issues.subject, issues.id"
|
||||||
|
|
Loading…
Reference in New Issue