TitleIsbnPagesPrice
Dies, Stratmann und Polifka27382184293610,00 €
Möcks, Strutz und Hooss4772422361310,00 €
Sehls-Sürth31030179034930,00 €
Hanniske UG27479313683490,00 €
Franta UG5358479013670,00 €
Rach-Hütter230986313910180,00 €
Moormann-Linnenbaum16947678131220,00 €
Steffen GmbH & Co. KG8319459314610,00 €
Klein, Heberstreit und Weller1181177449830,00 €
Green, Borrmann und Hepperle34849425506560,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:
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