Add methods to retrieve invoices and estimates for vehicles

This commit is contained in:
2026-01-31 12:46:30 -05:00
parent 88b0ffcd6b
commit 8bb98d2408

View File

@@ -71,6 +71,16 @@ class Vehicle < ActiveRecord::Base
end
self.name = to_s
end
# reurns all invoices for this vehicle
def invoices
self.issues.flat_map(&:invoices).uniq
end
# returns all estimates for this vehicle
def estimates
self.issues.flat_map(&:estimate).uniq
end
private