Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set a custom name for CSV file #4162

Closed
rakvium opened this issue Oct 16, 2015 · 2 comments · Fixed by #4819
Closed

Add ability to set a custom name for CSV file #4162

rakvium opened this issue Oct 16, 2015 · 2 comments · Fixed by #4819

Comments

@rakvium
Copy link
Contributor

rakvium commented Oct 16, 2015

I haven't find an option to customize a name in the normal way, so I incidentally did some code like this:

module ActiveAdmin
  class ResourceController < BaseController
    module Streaming
      def csv_filename
        return 'User Details.csv' if resource_collection_name == :users
        super
      end
    end
  end
end

Could you please provide such an option if you have some time?
P.S.: I will also be happy if you'll provide me with a more peaceful way to rename a CSV file

@drn
Copy link
Contributor

drn commented Nov 28, 2016

I just ran into this and I was able to override the csv_filename method in the specific admin page.

ActiveAdmin.register User do
  controller do
    def csv_filename
      'User Details.csv'
    end
  end
end

I realize this issue is a year old, so this might not have been possible at the time this issue was opened.

@varyonic
Copy link
Contributor

Document this in 4-csv-format.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants