working on image feature
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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
|
||||
Reference in New Issue
Block a user