TitleIsbnPagesPrice
Lesch, Kowalick und Meloni758183523600,00 €
Konya-Moguenara203281115360,00 €
Kohrt KG171627753370,00 €
Kohnle UG221052687500,00 €
Duma-Sporrer827596343330,00 €
Biesenbach UG199221985620,00 €
Haaf, Bak und Moede597448001530,00 €
Eckhardt, Klaus und Stengel519392881600,00 €
Sachse, Nau und Beele826708146140,00 €
Tsamonikian, Schwirkschlies und Gadschiew479438346330,00 €

Download as CSV

HAML:
= table_go_for @books, Book, :table_html => {:class => 'table table-striped table-hover table-bordered'} do |t|
  - t.column :title
  - t.column :isbn
  - t.column :pages
  - t.column :price, :as => :currency
= link_to('Download as CSV', books_path(format: :csv), class: 'btn btn-primary')
Controller:
# frozen_string_literal: true

class BooksController < ApplicationController
  def index
    @books = Book.paginate(pagination_defaults)

    respond_to do |format|
      format.html
      format.csv do
        send_data(render_to_string(template: 'books/index', format: :csv),
                  type: 'text/csv; charset=utf-8; header=present',
                  filename: 'books.csv',
                  disposition: 'attachment')
      end
    end
  end
end