Class: Tally::RecordsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tally/records_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/tally/records_controller.rb', line 4

def index
  records = search.records.page(params[:page]).per(params[:per_page] || 24).without_count

  render json: {
    records: records.map { |record|
      RecordPresenter.new(record).to_hash
    },
    meta: {
      next_page: records.next_page,
      current_page: records.current_page,
      previous_page: records.prev_page,
      per_page: records.limit_value
    }
  }
end