From ff99a53197a9413d7a33491b2f254f701d7ad901 Mon Sep 17 00:00:00 2001 From: svyatskaya Date: Wed, 12 Apr 2017 16:38:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B0=20=20(=D1=81?= =?UTF-8?q?=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=D0=BE=20=D1=81=20#107532)=20?= =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D0=B8=20=D0=B4=D0=B5=D1=80=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=20(=D1=81=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=D0=BE=20=D1=81?= =?UTF-8?q?=20#107534)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Рефакторинг: удаление неиспользуемых методов. --- app/models/query.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/models/query.rb b/app/models/query.rb index 2d646a2..c17f045 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -669,12 +669,8 @@ class Query < ActiveRecord::Base def grouped_query(&block) r = nil if grouped? - begin - # Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value - r = yield base_group_scope - rescue ActiveRecord::RecordNotFound - r = {nil => yield(base_scope)} - end + r = yield base_group_scope + c = group_by_column if c.is_a?(QueryCustomFieldColumn) r = r.keys.inject({}) {|h, k| h[c.custom_field.cast_value(k)] = r[k]; h} -- 2.7.4