Class: Fae::FilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fae/files_controller.rb

Instance Method Summary collapse

Methods included from NavItems

#nav_items

Instance Method Details

#delete_fileObject

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 nothing: true
end