Given the following code, is there a way to test whether the iteration is on the last record? I have given a little pseudocode on the line I would like to test.
@shipments.each do |shipment|
puts shipment.id
puts shipment.desc
unless shipment.last? #is there a way to do this line?
puts "that was the last shipment"
end
end
By using the #last method you could do something like that, but I believe there should be a better way to achieve this