Class: ActiveStorageDashboard::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ActiveStorageDashboard::AttachmentsController
- Defined in:
- app/controllers/active_storage_dashboard/attachments_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#download ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/active_storage_dashboard/attachments_controller.rb', line 27 def download = ActiveStorage::Attachment.find(params[:id]) @blob = .blob # Pass along the disposition parameter if present if params[:disposition].present? redirect_to download_blob_path(@blob, disposition: params[:disposition]) else redirect_to download_blob_path(@blob) end end |
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/active_storage_dashboard/attachments_controller.rb', line 5 def index = ActiveStorage::Attachment.order(created_at: :desc) # Get record types for filter dropdown @record_types = ActiveStorage::Attachment.distinct.pluck(:record_type).compact.sort # Get content types for filter dropdown @content_types = ActiveStorage::Blob.joins(:attachments).distinct.pluck(:content_type).compact.sort # Apply filters apply_filters # Pagination after filters @total_count = .count = paginate() end |
#show ⇒ Object
22 23 24 25 |
# File 'app/controllers/active_storage_dashboard/attachments_controller.rb', line 22 def show = ActiveStorage::Attachment.find(params[:id]) @blob = .blob end |