Patch #26323 » 0001-107532.patch
| app/models/query.rb | ||
|---|---|---|
| 669 | 669 |
def grouped_query(&block) |
| 670 | 670 |
r = nil |
| 671 | 671 |
if grouped? |
| 672 |
begin |
|
| 673 |
# Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value |
|
| 674 |
r = yield base_group_scope |
|
| 675 |
rescue ActiveRecord::RecordNotFound |
|
| 676 |
r = {nil => yield(base_scope)}
|
|
| 677 |
end |
|
| 672 |
r = yield base_group_scope |
|
| 673 | ||
| 678 | 674 |
c = group_by_column |
| 679 | 675 |
if c.is_a?(QueryCustomFieldColumn) |
| 680 | 676 |
r = r.keys.inject({}) {|h, k| h[c.custom_field.cast_value(k)] = r[k]; h}
|