westonganger/spreadsheet_architect

Empty Relation

robbytobby opened this issue · 1 comments

There's a problem in module SpreadsheetArchitect

line 38 ( Helpers#get_options )
array = options[:spreadsheet_columns] || options[:data].first.spreadsheet_columns
raises
undefined method 'spreadsheet_columns' for nil:NilClass
if the controller returns no records at all.

I think that should at least raise a specific error in a guard clause
raise SpreadsheetArchitect::NoDataError if options[:data].none?

works as expected. Thanks.