mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-02-13 01:33:58 -05:00
Add methods to retrieve invoices and estimates for vehicles
This commit is contained in:
@@ -72,6 +72,16 @@ class Vehicle < ActiveRecord::Base
|
||||
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
|
||||
|
||||
# init method to pull JSON details from NHTSA
|
||||
|
||||
Reference in New Issue
Block a user