replace overwritten find by default_scope

pull/6827/head
Jens Ulferts 9 years ago
parent 54062f3ff8
commit b5bb1c41b2
  1. 15
      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)

Loading…
Cancel
Save