phase002 complete

This commit is contained in:
2026-09-15 20:28:07 -06:00
parent 9793cd08bc
commit a3a65c24ed
28 changed files with 656 additions and 13 deletions
+18
View File
@@ -0,0 +1,18 @@
class FuelEntry < ApplicationRecord
belongs_to :vehicle
belongs_to :updated_by_user, class_name: "User"
validates :odometer, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :gallons_pumped, presence: true, numericality: { greater_than: 0 }
validates :price_paid, presence: true, numericality: { greater_than: 0 }
validates :date, presence: true
validate :date_cannot_be_in_the_future
private
def date_cannot_be_in_the_future
return if date.blank? || date <= Date.current
errors.add(:date, "can't be in the future")
end
end