Commit ac7b4c80 by liyijie

if column_hash not table rescue error

parent 7d65dd8e
......@@ -5,8 +5,9 @@ RSpec.describe '<%= controller_path %>', type: :request, capture_examples: true,
type: :object, properties: {
<%= resource_singular %>: {
type: :object, properties: {
<%- if resource_class.respond_to?(:columns_hash) && resource_class&.columns_hash.present? -%>
<%- resource_class.respond_to?(:columns_hash) && resource_class.columns_hash.except('id', 'created_at', 'updated_at').values.each do |column| -%>
<%- column_hash = resource_class.columns_hash rescue [] -%>
<%- if columns_hash.present? -%>
<%- resource_class.columns_hash.except('id', 'created_at', 'updated_at').values.each do |column| -%>
<%= column.name %>: { type: :<%= column.type %>, description: '<%= column&.comment %>' },
<%- 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