Re: Each returns just last array

Felipe Pieretti Umpierre
Wed, 15 Feb 2012 10:51:10 -0000

Hello, what I want to do, the user gonna insert a string with right
combinations.

So, the user gonna put, the email[comma]name[semincolon]

This way, I need to split the semicolon, to have the array of strings,
after I need to split the comma, to have the name in a index, and the
email in another.

emails = params[ :email ][ :email ].split( ";" )
    array = []

    emails.each do |e|

      foreach = e.split( ";" )
      array << foreach

      @a = array

    end

["myemail-S8S1utOw9MsAvxtiuMwx3w@public.gmane.org,My Name"]
["myemail-4cajJJ5tN1zQT0dZR+AlfA@public.gmane.org,My Name 2"]

But I can''t access the index to split the comma.

Thank you