[Rails] Delete duplicate records from a 2 dimensional array in rails

2013-09-09 Thread Crispin Schäffler
@tran = Transport.where( date: date, vehicle: vehicle) @mem = @tran.members Iterate in view @mem.each do |mem| mem.name mem.vehicle Should work if you have the relations set up. You should go read one or two tutorials about relations and how to set them up. -- You received this message b

[Rails] Delete duplicate records from a 2 dimensional array in rails

2013-09-08 Thread pradeep83 . achu
Hello, I am trying to insert elements into 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.tra