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:
parent
ea46d4d8de
commit
3b5c82bd28
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue