Hi Julian,
Here is what the code I tried
<% result=[]%>
<%date=[] %>
## An array from database with select all query
<% @eventall.each do |test| %>
<%i1= test.when%>
<%i2 =test.to%>
<%i3=i1.to_s.gsub('-','') %>
<%i4=i2.to_s.gsub('-','')%>
<%span =i3..i4%>
<%date=span.each { |x| puts x }%>
<%date.each_with_index do |value, key|%>
<% result.push(value)%>
<%end%>
<%end%>
## An array which contains 'color' and 'what' value concatinated
<% wattt = [] %>
<% for watl in @eventall%>
<% wattt << watl.what.concat(watl.color)%>
<%end%>
## This is the code i did to combine both array to fill the date between
certain range to corresponding value
<%hash = {}%>
<%result.each { |d| hash[d] = [] }%>
<%result.each_with_index { |x,i| hash[x] << wattt[i] }%>
<%hash.each_key { |key| hash[key] = hash[key].join('-') }%>
<% hash.each do |d,v| %>
<%= d%><%= v%><br>
<%end%>
Hope I explained well.Tell me if I'm not clear.
Thanks,
Shankar.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---