And even more generic

This commit is contained in:
2018-05-06 14:31:07 -03:00
parent b2516305b2
commit 6fb5f04e90
+2 -2
View File
@@ -179,8 +179,8 @@ module Dunlop::SourceFileModel
# braindump towards state => processed support for source-files
def latest_processed
if base_class == self
join_select = processed.select('MAX(id) AS max_id').group(:sti_type)
if base_class == self # return a scope having only the latest processed source-files
join_select = processed.select('MAX(id) AS max_id').group(inheritance_column)
#join_select = processed.selecting{ id.maximum.as('max_id')}.group(:sti_type)
joins("INNER JOIN (#{join_select.to_sql}) tmp ON id = tmp.max_id")
else # return the latest process of the specific source-file class