Class: Admin::MailDeliveryStatusController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/mail_delivery_status_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



23
24
25
26
27
28
29
# File 'app/controllers/admin/mail_delivery_status_controller.rb', line 23

def destroy
  @maildeliverystatus = MailDeliveryStatus.find(params[:id])
  @maildeliverystatus.destroy
  redirect_to admin_mail_delivery_status_index_path, notice: t('.notice')
rescue StandardError => e
  redirect_to admin_mail_delivery_status_index_path, alert: I18n.t('errors.general_msg', msg: e.message)
end

#destroy_allObject



16
17
18
19
20
21
# File 'app/controllers/admin/mail_delivery_status_controller.rb', line 16

def destroy_all
  @maildeliverystatus = MailDeliveryStatus.delete_all
  redirect_to admin_mail_delivery_status_index_path, notice: t('.notice')
rescue StandardError => e
  redirect_to admin_mail_delivery_status_index_path, alert: I18n.t('errors.general_msg', msg: e.message)
end

#indexObject



4
5
6
7
8
# File 'app/controllers/admin/mail_delivery_status_controller.rb', line 4

def index
  @maildeliverystatus = MailDeliveryStatus.order(created_at: :desc)
  @maildeliverystatus = @maildeliverystatus.where(email: params[:email]) if params[:email].present?
  @maildeliverystatus = @maildeliverystatus.page(params[:page]).per(@per_page)
end

#showObject



10
11
12
13
14
# File 'app/controllers/admin/mail_delivery_status_controller.rb', line 10

def show
  @maildeliverystatus = MailDeliveryStatus.find(params[:id])
  filename = "maildeliverystatus_#{params[:id]}.#{MIME::Types[@maildeliverystatus.attachment_mime].first.preferred_extension}"
  send_data(@maildeliverystatus.attachment_data, filename: filename, type: @maildeliverystatus.attachment_mime)
end