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 -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 On Oct 9, 5:31 pm, "Dark Ambient" <sambi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > --http://en.wikipedia.org/wiki/Dark_ambient--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 On 10/9/06, Bill Walton <bill.walton-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> > > 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 > > > >-- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---