Generating multiple empty columns within the CSV export #2352

Closed
alterisian opened this Issue Jul 16, 2013 · 5 comments

2 participants

@alterisian

Hi,

Would it be a useful addition to generate multiple empty columns i.e. 20 during a CSV export?

I've posted to stackoverflow for feedback on if this is already possible and I've missed it.
See:
http://stackoverflow.com/questions/17679232/generating-a-number-of-empty-columns-efficiently-within-activeadmins-csv-export

Would be great to get feedback on stackoverflow, or here on if it's an appropiate new feature.

Cheers,
Ian.

@seanlinsley
Active Admin member

Why would this be desired?

Nonetheless, you can always loop the column declaration:

csv do
  10.times{ column(''){} }
end
@alterisian

Thanks for the comment Daxter.

This is the approach I went for in the end as well - well slightly more verbose:
50.times do
column("") do |empty|
end
end

It is desired as often the utilities importing the exported CSV from admin areas require a certain number of columns, and require them to be present even if empty. In this case a bank import utility.

Originally when posting I thought I'd have to a very verbose version of posting a column per empty. I'm unsure if an extra method for empty_column would be desired now, up to others to make that call I guess.

Cheers,
Ian.

@seanlinsley
Active Admin member

I don't think this deserves its own DSL method, but this could certainly be added to our docs, if you want to write it up.

@seanlinsley
Active Admin member

Ah, no response? Okay, closing then.

@seanlinsley seanlinsley closed this Aug 5, 2013
@alterisian

Happy to write up. Sorry been busy. Currently on holiday. Will be a couple of weeks.

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