Open ignacio-chiazzo opened 1 month ago
Edit: I noticed that it was fixed in a newer version 🤦 (PR https://github.com/ctran/annotate_models/pull/895). I left the PR open in case you want the tests.
#
In case where the columns are frozen, the gem 💥 when annotating the models:
col = MyModel.columns.map { |n| [n.name, n.frozen?] } # => [[a, true], [b, true], [c, true]] col.frozen? #=> true col.type.to_s.frozen? # => true
The problem is that we're trying to modify the string when doing column_type << ... in lines:
column_type << ...
https://github.com/ctran/annotate_models/blob/5d01c4171990c4fe7b9b0977b05ce14a98209e53/lib/annotate/annotate_models.rb#L943-L953
I duplicated the value if it's frozen https://github.com/ctran/annotate_models/pull/1030/commits/95327bd25bcf0055b0f25757453b15ed0a98647a#diff-60ea710bcc08132bf411088124fcaa2b569a5ac493a5d364e0141f425afe2477R943
Edit: I noticed that it was fixed in a newer version 🤦 (PR https://github.com/ctran/annotate_models/pull/895). I left the PR open in case you want the tests.
#
In case where the columns are frozen, the gem 💥 when annotating the models:
The problem is that we're trying to modify the string when doing
column_type << ...
in lines:https://github.com/ctran/annotate_models/blob/5d01c4171990c4fe7b9b0977b05ce14a98209e53/lib/annotate/annotate_models.rb#L943-L953
The fix
I duplicated the value if it's frozen https://github.com/ctran/annotate_models/pull/1030/commits/95327bd25bcf0055b0f25757453b15ed0a98647a#diff-60ea710bcc08132bf411088124fcaa2b569a5ac493a5d364e0141f425afe2477R943