I am trying to loop an array like this..

     @mem = []
     @tran = Transport.find_all_by_month_and_vehicle(date,vehicle)
     tran.each do |t|
       @mem << [Student.find_by_id(t.mem_id), t.transport_date,
vehicle.no] if t.mem_type=="Student"
       @mem << [Employee.find_by_id(t.mem_id), t.transport_date,
vehicle.no] if t.mem_type=="Employee"
     end

And in the view page I am looping it and displaying it like this

     @mem.each do |m|
       <tr>
                 <td><%= link_to m[0].first_name} %></td>
                 <td > <%= m[0].age %></td>
                 <td id="date"> m[1] </td>
                 <td id="vehicle"> m[2] </td>
       </tr>
     <%end%>

But I am getting duplicates entries here..I need to remove duplicate
entries from this.. How do I do it?? Kindly help

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/278fe7ab10e92bab4b5a3d49ea0c8bba%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 6, '13 at 2:51p
activeSep 6, '13 at 2:51p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Ruby rails: 1 post

People

Translate

site design / logo © 2022 Grokbase