TitleIsbnPagesPrice
Lott-Brauer28152780538470,00 €
Sander-Waschbüsch11651626199840,00 €
Heydemüller, Schönball und Kúhn2792056564210,00 €
Knippel, Polifka und Schreiter1022058919180,00 €
Gaba-Gadschiew13357184367100,00 €
Keutel OHG7825361898950,00 €
Leitheim, Rahn und Hoppe31377165251020,00 €
Stein GmbH22967250834560,00 €
Lax UG24929313042490,00 €
Wittich-Schäning3151028890520,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