Reduce object allocations in Ransack::Nodes::Sort

`try` allocates an array on every call; we should avoid calling
it in hotspots.
This commit is contained in:
Jon Atack 2014-10-04 01:25:14 +02:00
parent ea46d4d8de
commit 3b5c82bd28
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ module Ransack
end
def dir=(dir)
dir = dir.try(:downcase)
dir = dir.downcase if dir
@dir = ASC_DESC.include?(dir) ? dir : ASC
end