# Phase 003 Execution ## Scope - Built the vehicle CRUD interface. - Made the vehicle index the root page. - Kept vehicle removal non-destructive by deactivating vehicles. - Added request specs for the vehicle UI flows. ## Changes - Added `VehiclesController` with index, show, new, create, edit, update, and destroy actions. - Added `resources :vehicles` and changed the root route to `vehicles#index`. - Added plain ERB views for vehicle index, detail, new, edit, and the shared form. - Added query-param filtering on the vehicle index: - default shows active vehicles - `status=inactive` shows inactive vehicles - `status=all` shows all vehicles - Implemented `destroy` as a deactivate action that sets `active` to `false`. - Displayed maintenance schedules, fuel history, and maintenance history on `vehicles#show`. - Ordered fuel and maintenance history newest first. - Updated home specs for the new root behavior. - Added vehicle request specs for successful and invalid create/update paths. - Added licence plate normalization to uppercase before validation. ## Decisions - Vehicles are not hard-deleted because maintenance and fuel history must be preserved. - The UI labels the destructive route as `Deactivate` to match actual behavior. - The vehicle show page is display-only for related schedules and histories in this phase. - Event creation remains reserved for Phase 004. - Maintenance schedule CRUD remains reserved for Phase 006. - Licence plates are standardized to uppercase before validation and storage. ## Verification - Passed: `bundle exec rspec spec/requests/vehicles_spec.rb` - Passed: `bundle exec rspec` - Passed for touched Phase 003 Ruby files: `bin/rubocop app/controllers/vehicles_controller.rb spec/requests/vehicles_spec.rb spec/requests/home_spec.rb spec/system/home_spec.rb` - Full `bin/rubocop` was not clean because of pre-existing unrelated `Gemfile` single-quote offenses.