Stan, > 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 > => []
That seems like it is probably a bug. I'm thinking it could be something weird with calling #reverse on an association that isn't persisted. Can you try to run your code with the dm-core/next branch? I just did a quick test of something similar at my end and it worked fine. -- Dan (dkubb) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
