send to me the file.. I will repair... I think use: array3 = {} array1.each_with_index do |x, i| array3[x] = array2[i] end
On Tue, Jan 27, 2009 at 8:50 PM, Shankar Ganesh < rails-mailing-l...@andreas-s.net> wrote: > > > <% array1 > =['01/01/2009','01/01/2009','10/01/2009','01/01/2009','10/01/2009'] %> > <%array2 = ['1stjan1','1stjan2','10thjan1','1stjan3','10thjan2']%> > <%array3 = {} %> > <%array2.each_with_index do |x, i|%> > <%array3[x] = array1[i]%> > <%end%> > <br> > <%=array3.inspect %> > > I'm getting o/p like this > > > {"1stjan1"=>"01/01/2009", "10thjan1"=>"10/01/2009", > "1stjan2"=>"01/01/2009", "10thjan2"=>"10/01/2009", > "1stjan3"=>"01/01/2009"} > > > > > anton effendi wrote: > > make sure..... > > array1 --> date > > array2 --> the value... > > > > or > > array3 = {} > > array1.each_with_index do |x, i| > > array3[x] = array2[i] > > end > > > > change to > > > > array3 = {} > > array2.each_with_index do |x, i| > > array3[x] = array1[i] > > end > > > > please try again > > > > On Tue, Jan 27, 2009 at 3:56 PM, Shankar Ganesh < > > rails-mailing-l...@andreas-s.net> wrote: > > > >> end > >> > ['01/01/2009'=>'1stjan1-stjan2-1stjan3','10/01/2009'=>'10thjan1-10thjan2'] > >> > thank you.. > >> >> array3 = > >> > > >> > -- > >> > Wu You Duan > >> > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > >> > > >> > > > > > > -- > > Wu You Duan > > -- > 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 -~----------~----~----~----~------~----~------~--~---