Sha256: 662e5194d33fb0ce5cb023edc92f23c645de15274d3af7a522c5d5da72838940

Contents?: true

Size: 924 Bytes

Versions: 47

Compression:

Stored size: 924 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 :options => { :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 (default is ",")
    config.csv_column_separator = ';'

    # Set the CSV builder options (default is {})
    config.csv_options = { :force_quotes => true }

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.59 vendor/deps/active_admin/docs/4-csv-format.md
lalala-4.0.0.dev.58 vendor/deps/active_admin/docs/4-csv-format.md
lalala-4.0.0.dev.57 vendor/deps/active_admin/docs/4-csv-format.md
lalala-4.0.0.dev.56 vendor/deps/active_admin/docs/4-csv-format.md
lalala-4.0.0.dev.50 vendor/deps/active_admin/docs/4-csv-format.md
lalala-4.0.0.dev.46 vendor/deps/active_admin/docs/4-csv-format.md
activeadmin-0.5.1 docs/4-csv-format.md