Class: Admin::ExportHistoriesController

Inherits:
BaseController show all
Defined in:
app/controllers/admin/export_histories_controller.rb

Constant Summary

Constants inherited from BaseController

BaseController::INTERNAL_SERVER_ERROR_MESSAGE

Instance Method Summary collapse

Methods inherited from BaseController

#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session

Methods included from LogrageCustomLogger

#append_info_to_payload

Methods included from AdminHelper

#dynamic_pricings_formatter, #link_to_admin_reservations_path_by_id, #link_to_admin_restaurants_path_by_id, #link_to_log, #optional_locales, #optional_locales_with_labels, #staff_signed_in?

Methods included from UpdateLocaleConcern

#setup_locale

Methods inherited from ApplicationController

#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=

Methods included from ControllerHelpers

#check_boolean_param, #get_banners, #inventory_params, #reservation_params

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/admin/export_histories_controller.rb', line 3

def index
  per_page = fetch_param(:per_page, 50)
  page = fetch_param(:page, 1)

  @export_histories = Attachment.where.not(exported_by: nil).order(id: :desc)
                                .page(page).per(per_page)
                                .then { |scope| filter_histories(scope) }

  respond_to do |format|
    format.html do
      set_meta_tags title: 'Export History'
      render
    end
    format.json do
      render json: @export_histories,
             meta: { total_count: @export_histories.count },
             each_serializer: ExportHistorySerializer,
             adapter: :json
    end
  end
end