Commit b1cb7abd by liyijie

add finder support for import

parent 3422215f
......@@ -15,6 +15,7 @@ module TalltyImportExport
# convert: 导入时候,把excel的内容转换成导入时候代码逻辑需要的内容
# primary_key: 是否是主键
# json: model_payload,代表存储在某一个列中
# finder: 执行代码,可以查找到相关的对象
# xlsx_file 为 file path or file object or TalltyImportExport::Excel.new
def import_xlsx xlsx_file, associations, **options
......@@ -84,6 +85,10 @@ module TalltyImportExport
if header[:json]
h[header[:json]] ||= {}
h[header[:json]][k] = val
elsif header[:finder]
$SAFE = 2
eval_string = header[:finder] + '(val)'
eval eval_string
else
h[k.to_sym] = val
end
......
module TalltyImportExport
VERSION = "1.0.15"
VERSION = "1.0.16"
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