I am extracting a series of strings from an XML stream and storing them in a mySQL Database (tried with VARCHAR and TEXT). At the start of each array, in the DB, I get --- and then either a [] if it is a blank array or the values.
Rake task code:
@issue = Array.new
items.each do |item| #items is the parsed elements from XML
link_key = item.xpath('key').inner_text
@issue << link_key
Rails.logger.debug("Issue: #{@issue.inspect}")
end
Database value example:
“— []”
-or-
“—
– CR-3528”
Not sure what else would be useful.
That’s because you’re serializing an array.
One way to deal with this is to mark a field as serialized with
serialize(docs):See this for additional details.
If you had been storing the value as text, you should not have seen this–it would have been just the text.