Method: CiniiBooksController#index

Defined in:
app/controllers/cinii_books_controller.rb

#indexObject



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

def index
  if params[:page].to_i == 0
    page = 1
  else
    page = params[:page]
  end
  @query = params[:query].to_s.strip
  books = CiniiBook.search(params[:query], page)
  @books = Kaminari.paginate_array(
    books[:items], :total_count => books[:total_entries], :page => page
  ).page(page).per(10)

  respond_to do |format|
    format.html
  end
end