TitleIsbnPagesPrice
Dold AG21924271887060,00 €
Klein, Tuschmo und Kesselschläger1842312278570,00 €
Raabe-Bigdeli29716096749700,00 €
Kreb, Köhre und Waibel33370679827960,00 €
Pfennig-Olbrich6982128589740,00 €
Felke-Kuschewitz14103747165130,00 €
Lewke OHG3651053572950,00 €
Tudow-Steigauf2057910793370,00 €
Thyssen UG17584788742990,00 €
Sinnhuber-Mensing19076891542890,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