TitleIsbnPagesPrice
Sievers, Hardy und Schmitt5323147174550,00 €
Baseda, Filsinger und Itt2556249743980,00 €
Splinter OHG1314754174340,00 €
Tonn, Mühleis und Kreissig33602668215010,00 €
Polizzi, Jansen und Vogel1371660551520,00 €
Henry-Zeyen34622083886580,00 €
Osei-Leist9527308968590,00 €
Daub GmbH5639684427780,00 €
Renk, Streck und Schuster18226671956820,00 €
Reinelt, Östringer und Pflieger15112590858040,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