text_field how to ?

I have a text field and want to let users insert multiple values - If I type one two , the sql statement is ‘1 2’ if i put a comma between it turns it to 1,\2 I need it to do ‘1’,2’ I tried some regex but no luck because whatever I do to format I’m getting back slashes.

Anything ? Stuart

split the field on the comma, then wrap each element in single quotes, then join the array with a comma:

values = params[:myfield].split(',').each {|v| v = "'#{v}'"}.join(',')

something along those lines... the above is untested

Hello Stuart.

Dark Ambient wrote:

I have a text field and want to let users insert multiple values -

Sorry to hear you're having problems. Shoudl we guess what your code looks like?

Bill

Bill my friend, hope your well. I believed what I had written was sufficient, my bad. Anyway, problem has been solved using .split(‘,’). Thank you for responding. I know sometimes I ask way too many questions here.

Stuart