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

Reset package and sheet before serializing #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/active_admin/axlsx/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def i18n_scope

# This is the I18n scope that will be used when looking up your
# colum names in the current I18n locale.
# If you set it to [:active_admin, :resources, :posts] the
# If you set it to [:active_admin, :resources, :posts] the
# serializer will render the value at active_admin.resources.posts.title in the
# current translations
# @note If you do not set this, the column name will be titleized.
Expand Down Expand Up @@ -129,6 +129,7 @@ def delete_columns(*column_names)
# Serializes the collection provided
# @return [Axlsx::Package]
def serialize(collection)
reset_sheet
@collection = collection
apply_filter @before_filter
export_collection(collection)
Expand Down Expand Up @@ -172,6 +173,10 @@ def export_collection(collection)
end
end

def reset_sheet
@package, @sheet = nil
end

# tranform column names into array of localized strings
# @return [Array]
def header_row(collection)
Expand Down