randym/activeadmin-axlsx

Active Admin scoped_collection

Opened this issue · 2 comments

When using a "scoped_collection" to limit the columns returned in an activerecord query you will get the error "ActiveModel::MissingAttributeError".

It appears that if you configure xlsx_builder to delete columns not present this error goes away.

@mmc1ntyre

The gem will pre-fetch all columns on the resource prior to generation so you can edit them in the builder dsl.
For this specific case, I've altered serialization to ensure that those attributes actually exist on the resource being passed in.

Can I ask you to have a go at what is currently on master and let me know if this solves the problem without requiring you to manually delete the columns that are not in scope?