From b5bb1c41b2924e94f69e4f4782b3c425fc2474d2 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Tue, 25 Aug 2015 16:40:56 +0200 Subject: [PATCH] replace overwritten find by default_scope --- app/models/impediment.rb | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/app/models/impediment.rb b/app/models/impediment.rb index c2f5b3c76b..7a18d30960 100644 --- a/app/models/impediment.rb +++ b/app/models/impediment.rb @@ -46,19 +46,8 @@ class Impediment < Task user.allowed_to?(:update_impediments, impediment.project) } - def self.find(*args) - if args[1] && args[1][:conditions] - if args[1][:conditions].is_a?(Hash) - args[1][:conditions][:parent_id] = nil - args[1][:conditions][:type_id] = type - elsif args[1][:conditions].is_a?(Array) - args[1][:conditions][0] += " AND parent_id is NULL AND type_id = #{type}" - end - else - args << { conditions: { parent_id: nil, type_id: type } } - end - - super + def self.default_scope + where(parent_id: nil, type_id: type) end def blocks_ids=(ids)