It's probably because datamapper makes a call to the database with the reverse method instead of just reversing the existing array.
On May 19, 10:32 am, Stanisław <[email protected]> wrote: > Hello, > recently, I come across this strange behavior. Why reverse method > returns empty array when it shouldn't? > > irb(main):001:0> l=Line.new > => #<Line id=nil no=nil> > irb(main):002:0> l.timetables.build :stop_id=>1 > => #<Timetable id=nil nice=nil stop_id=1 line_id=nil start=nil > table1=nil table2=nil table3=nil ratio=nil updated_at=nil> > irb(main):003:0> l.timetables > => [#<Timetable id=nil nice=nil stop_id=1 line_id=nil start=nil > table1=nil table2=nil table3=nil ratio=nil updated_at=nil>] > irb(main):004:0> l.timetables.reverse > => [] > > Stan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
