Refactor Project.abandoned method

This commit is contained in:
Dmitriy Zaporozhets 2013-06-11 16:57:52 +03:00
parent 4daf68b57f
commit e06e5633b3

View file

@ -110,11 +110,7 @@ class Project < ActiveRecord::Base
class << self
def abandoned
project_ids = Event.select('max(created_at) as latest_date, project_id').
group('project_id').
having('latest_date < ?', 6.months.ago).map(&:project_id)
where(id: project_ids)
where('projects.last_activity_at < ?', 6.months.ago)
end
def with_push