Display first image available for milestones

This commit is contained in:
decabeza
2018-09-12 18:36:17 +02:00
parent d698a724ac
commit ba1a6b4cc8
3 changed files with 25 additions and 13 deletions

View File

@@ -6,4 +6,9 @@ module BudgetExecutionsHelper
.last.status_id == status rescue false }.count
end
def first_milestone_with_image(investment)
investment.milestones.order(publication_date: :asc, created_at: :asc)
.select{ |milestone| milestone.image.present? }.first
end
end