Class: Satis::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Satis::AttachmentsController
- Defined in:
- app/controllers/satis/attachments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/satis/attachments_controller.rb', line 7 def create @model.public_send(@attribute).attach(params[:attachments]) @attachments = @model.public_send(@attribute).last(params[:attachments].size) respond_to do |format| format.html { redirect_to request.referer || root_path, notice: "Attachment created successfully." } format.turbo_stream end end |
#destroy ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/satis/attachments_controller.rb', line 17 def destroy @attachment = @model.public_send(@attribute).find_by(id: params[:id]) @attachment&.purge respond_to do |format| format.html { redirect_to request.referer || root_path, notice: "Attachment deleted successfully." } format.turbo_stream end end |