TitleIsbnPagesPrice
Lohmann UG26125377058260,00 €
Rath GmbH22875056422000,00 €
Kahlert, Krohn und May1504818488410,00 €
Hartz-Freigang25825948886090,00 €
Krause, Herold und Münch26513215979830,00 €
Büker-Krug22513566011710,00 €
Hessek-Spank193522507310160,00 €
Friedrich Gruppe13097093067350,00 €
Gruszecki-Haaf9471179668900,00 €
Seiders GmbH26089070388320,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