Skip to content

Commit b22fc47

Browse files
authored
Fix annotation for columns with Date and DateTime default values (#61)
In #58, it changed the default behavior for unhandled types from `#inspect` to `#to_s`. I didn't consider to add test cases for dates or datetimes which led to a regression. I tried writing unit tests for it, but realized that it wouldn't work easily because Rails monkey patches `#inspect`: https://github.com/rails/rails/blob/44bd6e7acaa91dd59c260beea6863a49b84f6039/activesupport/lib/active_support/core_ext/date/conversions.rb#L63-L67 Testing this behavior will be handled in a separate PR.
1 parent 65b58f8 commit b22fc47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/annotate_rb/model_annotator/column_annotation/default_value_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def quote(value)
3636
when BigDecimal then value.to_s("F")
3737
when String then value.inspect
3838
else
39-
value.to_s
39+
value.inspect
4040
end
4141
end
4242

0 commit comments

Comments
 (0)