mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-19 05:38:08 +01:00
Fasterer: Enumerable#sort is slower
Enumerable#sort is slower than Enumerable#sort_by
This commit is contained in:
parent
5092b388fe
commit
405ad5a79f
2 changed files with 2 additions and 2 deletions
|
|
@ -34,7 +34,7 @@ class User < ActiveRecord::Base
|
|||
}
|
||||
end
|
||||
def projects_in_state_by_position(state)
|
||||
self.sort{ |a,b| a.position <=> b.position }.select{ |p| p.state == state }
|
||||
self.sort_by{ |p| p.position }.select{ |p| p.state == state }
|
||||
end
|
||||
def next_from(project)
|
||||
self.offset_from(project, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue