Sha256: 2bc20b2ffcab68ecfc793fc114da0c74eac10bb11246a5b0e8cd1fd53fb7e326

Contents?: true

Size: 878 Bytes

Versions: 7

Compression:

Stored size: 878 Bytes

Contents

# Customizing the CSV format

Active Admin provides CSV file downloads on the index screen for each Resource.
By default it will render a CSV file with all the content columns of your
registered model.

Customizing the CSV format is as simple as customizing the index page.

    ActiveAdmin.register Post do
      csv do
        column :title
        column("Author") { |post| post.author.full_name }
      end
    end

You can set custom csv options:

    ActiveAdmin.register Post do
      csv :force_quotes => true do
        column :title
        column("Author") { |post| post.author.full_name }
      end
    end

You can set options for the CSV format system-wide:

    # config/initializers/active_admin.rb
    # Set the CSV builder separator
    config.csv_options = { :col_sep => ';' }

    # Force the use of quotes
    config.csv_options = { :force_quotes => true }

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
activeadmin-0.6.6 docs/4-csv-format.md
activeadmin-0.6.5 docs/4-csv-format.md
activeadmin-0.6.4 docs/4-csv-format.md
activeadmin-0.6.3 docs/4-csv-format.md
activeadmin-0.6.2 docs/4-csv-format.md
activeadmin-0.6.1 docs/4-csv-format.md
aa-rails4-0.6.0 docs/4-csv-format.md