Commit e093080d by Ivan Lan

add autoload FormConvert

parent b97c253d
...@@ -12,6 +12,7 @@ module TalltyImportExport ...@@ -12,6 +12,7 @@ module TalltyImportExport
autoload :Importable autoload :Importable
autoload :Import autoload :Import
autoload :Context autoload :Context
autoload :FormConvert
class Error < StandardError; end class Error < StandardError; end
end end
...@@ -14,7 +14,7 @@ module TalltyImportExport ...@@ -14,7 +14,7 @@ module TalltyImportExport
# method: 导出时本地调用的方法 # method: 导出时本地调用的方法
# chain: 导出时对象属性通过链式调用 # chain: 导出时对象属性通过链式调用
def export_xlsx records, options={} def export_records records, options={}
exportable_defaults(options) exportable_defaults(options)
options = options.with_indifferent_access options = options.with_indifferent_access
...@@ -67,7 +67,6 @@ module TalltyImportExport ...@@ -67,7 +67,6 @@ module TalltyImportExport
end end
def export_headers def export_headers
binding.pry
klass.try(:headers) || klass.try(:model_headers) klass.try(:headers) || klass.try(:model_headers)
end end
......
module TalltyImportExport module TalltyImportExport
class FormConvert class FormConvert
class << self class << self
def import_headers form, column_name: :payload def headers form, column_name: :payload
form.fields.map do |field| form.fields.map do |field|
{}.tap do |q| {}.tap do |q|
q[:key] = field.key q[:key] = field.key
......
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