In my database, there are some text content, one of them is:
<% abc do %>
ddd
<% end %>
When I dumped it to yaml with to_yaml()
, it is like:
content: |-
<% abc do %>
ddd
<% end %>
And then, when I use rake db:fixtures:load
, such error occurs:
The exact error was:
NoMethodError: undefined method 'abc' for main:Object
I checked the source of db:fixtures:load
, and found rails will not treat the content as plain text, but 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.