TitleIsbnPagesPrice
Jungbluth Gruppe16010693989150,00 €
Stauss, Kinzy und Strieder175634710710020,00 €
Volk, Porth und Schütze18108847118570,00 €
Lammert KG6150172268030,00 €
Reus, Grasse und Scheurer6907195875980,00 €
Fahner OHG22936381073050,00 €
Hildebrand, Hessler und Fink15633962664720,00 €
Jegorov GmbH & Co. KG32110633411080,00 €
Laack-Koszewski33405363911690,00 €
Hildenbrand, Giehl und Laux31773920429800,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