19 lines
474 B
Ruby
19 lines
474 B
Ruby
class FuelEntryImagesController < ApplicationController
|
|
def destroy
|
|
attachment = fuel_entry.images.attachments.find(params[:attachment_id])
|
|
attachment.purge
|
|
|
|
redirect_to images_vehicle_fuel_entry_path(vehicle, fuel_entry), status: :see_other, notice: "Fuel image deleted."
|
|
end
|
|
|
|
private
|
|
|
|
def vehicle
|
|
@vehicle ||= Vehicle.find(params[:vehicle_id])
|
|
end
|
|
|
|
def fuel_entry
|
|
@fuel_entry ||= vehicle.fuel_entries.find(params[:fuel_entry_id])
|
|
end
|
|
end
|