@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
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
2 matches
Mail list logo