In my database, there is some text content, one of them is:
& Lt;% ABC%> Ddd & lt;% end% & gt;
When I put it in yaml with to_yaml ()
, then it is:
Content: | - & lt;% make ABC%> Ddd & lt;% end% & gt;
And then, when I use rake db: fixtures: load
, then such error occurs:
The exact error was: NoMethodError: Undefined method for main 'ABC': object
I have checked the source of the db: fixtures: load
, and found That text will not be considered plain material, but the erb
template, so it will try to find and execute the 'abc' method.
How can I fix this? I think the default 'to_yaml' should not be used.
We '& lt;%' such as:
I am doing now Before I wrote the file, I did not call '<'% all '& lt; %% 'but it does not always work correctly. If there are some non-English pigments in the material, the content will be dumped as 'binary', not the text. Then when read back, '& lt; %% 'will not be converted to' & lt;% '
Comments
Post a Comment