File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,15 @@ def anchor_attributes_properties(included_fields:)
7878
7979 enum = Anchor . config . infer_ar_enums && !method_defined && _model_class . try ( :defined_enums ) . try ( :[] , model_method . to_s )
8080 column = !method_defined && _model_class . try ( :columns_hash ) . try ( :[] , model_method . to_s )
81- if enum
82- Anchor ::Types ::Union . new ( enum . map { |_key , val | Anchor ::Types ::Literal . new ( val ) } )
83- elsif column
81+
82+ if column
8483 type = Anchor ::Types ::Inference ::ActiveRecord ::SQL . from ( column )
84+
85+ if enum
86+ enum_type = Anchor ::Types ::Union . new ( enum . map { |_key , val | Anchor ::Types ::Literal . new ( val ) } )
87+ type = type . is_a? ( Anchor ::Types ::Maybe ) ? Anchor ::Types ::Maybe . new ( enum_type ) : enum_type
88+ end
89+
8590 unless description
8691 description = column . comment if Anchor . config . use_active_record_comment
8792 if description && !Anchor . config . ar_comment_to_string . nil?
You can’t perform that action at this time.
0 commit comments