Files
nairobi/app/components/budgets/executions/image_component.rb
Javi Martín 00ea1bf719 Fix customization of budget_execution_no_image
We forgot to change the line rendering the image in commits 3574bf867c
and 810bdae37a, and so the custom image was being ignored.

Note that, in the test, we're stubbing a constant instead of adding a
new image. The main reason is that, if we add a new image, forks would
have to change the image when they change the `VALID_IMAGES` constant;
otherwise the tests would fail.
2022-08-17 12:53:00 +02:00

16 lines
374 B
Ruby

class Budgets::Executions::ImageComponent < ApplicationComponent
attr_reader :investment
delegate :image_path_for, to: :helpers
def initialize(investment)
@investment = investment
end
private
def milestone
investment.milestones.order_by_publication_date
.select { |milestone| milestone.image.present? }.last
end
end