I’m trying to take a string in the format “word[field] and
word2[field2]…”, etc. I have gotten this to work when splitting it in
IRB using the following syntax:
tempstring.split(/[|]/)
which returns:
[“word”, “field”, “word2”, “field2”,…]
However, when I attempt to make the exact same call in a rails
controller, I get the following error message on the line where
String#split is called.
“can’t convert Regexp into String”
However, I don’t know why it should be trying to convert my Regexp into
a string, when the API shows you can use strings or regular expressions.
–> http://www.ruby-doc.org/core/classes/String.html#M000818
If you can’t figure it out from what I have given and need more code to
look at, let me know.
Thanks,
JT