The scope breaks at this line, I think you need to provide the WorkPackage.table_name for updated_at just as in the "open" scope below.