TitleIsbnPagesPrice
Bosler UG29892218121310,00 €
Saumweber-Eckhardt9045120734970,00 €
Renk GmbH & Co. KG34819779145340,00 €
Borrmann-Gesell30821864877360,00 €
Riekmann-Lauckner27182049993030,00 €
Stahl GmbH & Co. KG1420520974520,00 €
Deckert-Töpfer5643847249920,00 €
Osenberg GmbH & Co. KG30141362954780,00 €
Green AG24024771408860,00 €
Wollmann-Kummle19142550339380,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