gregbell/active_admin — pull request #2898 by shekibobo (2014-01-25 20:19:06+00:00)
Title: Let current controller instance be available to csv block

Possibly fixes #2798.

I don't particularly like this solution, but it seems like the simplest way to make it happen without any huge rewrites.

Basic concept:

1. Don't evaluate the columns block when AA loads, but store the block to run later.
2. Pass the current controller instance into the CSVBuilder whenever we render.
3. Clear out the columns before we render, since they could be different depending on the current request
4. Call to render the columns from the CSV view, and evaluate our dsl block when we actually make a request

Now, `csv` will behave slightly more like `index`, in that we can modify our columns given some detail about the current request, such as a parent `belongs_to` resource or a parameter that was passed.