I am trying to parse a SQL query string into a hash. Example:
field = value AND field2 = value2 becomes { field: 'value', field2: 'value2' }
I have tried Rack::Utils.parse, which works great for URL params, but doesn't for SQL query string.
My initial thoughts are to split by AND, OR etc and then use Rack::Utils.parse recursively.
I was thinking there would be a straightforward way of doing this in Rails, but I haven't found anything yet. Has anyone accomplished this before?
Thanks in advance.