Haii... I will try help u. array3 = ['01/01/2009'=>'1stjan1-stjan2-1stjan3','10/01/2009'=>'10thjan1-10thjan2'] -> *this is not array.. this is hash..*
The code is array3 = {} array1.each_with_index do |x, i| array3[x] = array2[i] end may be it can help u.. thank you.. fyi ==> array1.length == array2.length --> this is rule for that case....( *MUST*) On Tue, Jan 27, 2009 at 2:13 PM, Shankar Ganesh < rails-mailing-l...@andreas-s.net> wrote: > > Hi , > I need to merge an array in ruby on rails. > > array1 = > ['01/01/2009','01/01/2009','10/01/2009','01/01/2009','10/01/2009'] > array2 = ['1stjan1','1stjan2','10thjan1','1stjan3','10thjan2'] > > I need to have array like this > > array3 = > ['01/01/2009'=>'1stjan1-1stjan2-1stjan3','10/01/2009'=>'10thjan1-10thjan2'] > > Thanks in Advance. > -- > Posted via http://www.ruby-forum.com/. > > > > -- Wu You Duan --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---