Class: Panel::AttachmentsController

Inherits:
BaseController show all
Defined in:
app/controllers/com/panel/attachments_controller.rb

Constant Summary

Constants included from RailsCom::Application

RailsCom::Application::LOCALE_MAP

Instance Method Summary collapse

Methods included from RailsCom::Application

#current_title, #default_form_params, #default_params, #json_format?, #set_country, #set_flash, #set_locale, #set_timezone, #set_variant

Instance Method Details

#deleteObject



16
17
18
19
# File 'app/controllers/com/panel/attachments_controller.rb', line 16

def delete
  @attachment.destroy
  render 'destroy'
end

#destroyObject



21
22
23
# File 'app/controllers/com/panel/attachments_controller.rb', line 21

def destroy
  @attachment.purge
end

#garbledObject



11
12
13
14
# File 'app/controllers/com/panel/attachments_controller.rb', line 11

def garbled
  @attachments = ActiveStorage::Attachment.garbled.order(id: :desc).page(params[:page])
  render :index
end

#indexObject



5
6
7
8
9
# File 'app/controllers/com/panel/attachments_controller.rb', line 5

def index
  q_params = {}
  q_params.merge! params.permit(:id, :record_type, :record_id, :name)
  @attachments = ActiveStorage::Attachment.default_where(q_params).order(id: :desc).page(params[:page])
end