Commit ebcad94c by liyijie

fix: common model_headers use klass

parent d0a65122
...@@ -6,14 +6,14 @@ module TalltyImportExport ...@@ -6,14 +6,14 @@ module TalltyImportExport
end end
module ClassMethods module ClassMethods
def model_headers **args def model_headers(**args)
columns.map do |column| klass.columns.map do |column|
{ {
key: column.name, key: column.name,
name: column.comment || column.name, name: column.comment || column.name,
attr_type: column.type, attr_type: column.type,
format: column.type == :string ? :string : nil, format: column.type == :string ? :string : nil,
primary_key: column.name == 'id' ? true : false primary_key: column.name == 'id',
} }
end end
end 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