I'm having a weird issue where if say....
someobject.items.sort_by {|item| item.key }
#or
someobject.items.sort_by &:key
#then
someobject.items.each do |item|
#somestuff
end
#somestuff is not in sorted order. if i use different syntax...
questionnaire.items.sort! { |a,b| a.key <=> b.key }
this works fine. why is that? does it matter?
rails --version
Rails 2.1.1
ruby --version
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---