Class: Fae::FilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Fae::FilesController
- Defined in:
- app/controllers/fae/files_controller.rb
Instance Method Summary collapse
-
#delete_file ⇒ Object
ajax delete action.
Instance Method Details
#delete_file ⇒ Object
ajax delete action
post ‘files/:id/delete_file’ => ‘files#delete_file’, as: :delete_file here we just remove the asset from the attached file model, because if we deleted the model itself, re-uploading a new one would break.
8 9 10 11 12 13 |
# File 'app/controllers/fae/files_controller.rb', line 8 def delete_file file = Fae::File.find_by_id(params[:id]) file.remove_asset = true file.save render body: nil end |