Sha256: 5653a1702a824c777a67b3c5d6e9a2bb4e047f139a5608dc007c74c51e5b5730

Contents?: true

Size: 1.67 KB

Versions: 48

Compression:

Stored size: 1.67 KB

Contents

class <%= exporter_class_name %> < Para::Exporter::Csv
  def name
    '<%= file_name %>'
  end

  protected

  # Defining the fields that you want to export will export all those fields
  # directly to the CSV file
  #
  def fields
    [:id]
  end

  # If you need special behavior in the row generation (rendering associated
  # models or other specific logic), you can return an array here that will
  # be written to the CSV
  #
  # For safe CSV writing, use the #encode method on every string in the
  # returned array.
  #
  # Example :
  #
  #   fields = [...]
  #   fields.map!(&:encode)
  #
  # def row_for(resource)
  # end

  # Whitelist params to be fetched from the controller and passed down to the
  # exporter.
  #
  # For example, if you want to export posts for a given category, you
  # can add the `:category_id` param to your export link, and whitelist
  # this param here with :
  #
  #   def self.params_whitelist
  #     [:category_id]
  #   end
  #
  # It will be passed from the controller to the importer so it can be used
  # to scope resources before exporting.
  #
  # Note that you'll manually need to scope the resources by overriding the
  # #resources method.
  #
  # If you need automatic scoping, please use the `:q` param that accepts
  # ransack search params and applies it to the resources.
  #
  # def self.params_whitelist
  #   []
  # end

  # If you need complete control over you CSV generation, use the following
  # method instead of the #fields or #row_for methods, and return a valid CSV
  # string
  #
  # You can use the `csv` extension from the ruby stdlib, for example with the
  # CSV.generate method (more information )
  #
  # def generate
  # end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
para-0.12.5 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.12.4 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.12.3 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.12.2 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.12.1 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.12.0 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.11.4 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.11.3 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.11.2 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.11.1 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.11.0 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.10.0 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.9.4 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.9.3.3 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.9.3.2 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.9.3.1 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.9.2 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.9.0 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.8.15 lib/generators/para/exporter/templates/csv_exporter.rb
para-0.8.14 lib/generators/para/exporter/templates/csv_exporter.rb