Commit 2ea9273c by liyijie

fix import headers instead of @headers

parent 178a7866
......@@ -52,9 +52,9 @@ module TalltyImportExport
def process_options options
options = options.with_indifferent_access
self.headers = options.delete(:headers) || []
@primary_keys = options.delete(:primary_keys) || headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
@primary_keys = options.delete(:primary_keys) || @headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
@excel_hash = headers.reduce({}) do |h, header|
@excel_hash = @headers.reduce({}) do |h, header|
h[header[:key].to_sym] = header[:name]
h
end
......@@ -75,7 +75,7 @@ module TalltyImportExport
def convert_data line_info
line_info.with_indifferent_access.reduce({}) do |h, (k, v)|
header = headers.find do |_header|
header = @headers.find do |_header|
_header[:key].to_sym == k.to_sym
end
# header[:convert] = handle_xxx
......
module TalltyImportExport
VERSION = "1.0.5"
VERSION = "1.0.6"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment