Sha256: d6f0ec3de91e2d89e6dc5bc0fcad85fd84cdb1ffd005cb67d7d389c374ed3d41

Contents?: true

Size: 646 Bytes

Versions: 8

Compression:

Stored size: 646 Bytes

Contents

module Fae
  class FilesController < ApplicationController
    # 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.
    def delete_file
      file = Fae::File.find_by_id(params[:id])
      file.remove_asset = true
      file.save
      render nothing: true
    end

    private

    # allow mass assignment
    def file_params
      if params[:file].present?
        params.require(:file).permit!
      else
        nil
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fae-rails-1.4.1 app/controllers/fae/files_controller.rb
fae-rails-1.4.0 app/controllers/fae/files_controller.rb
fae-rails-1.3.1 app/controllers/fae/files_controller.rb
fae-rails-1.3.0 app/controllers/fae/files_controller.rb
fae-rails-1.2.5 app/controllers/fae/files_controller.rb
fae-rails-1.2.4 app/controllers/fae/files_controller.rb
fae-rails-1.2.3 app/controllers/fae/files_controller.rb
fae-rails-1.2.2 app/controllers/fae/files_controller.rb