Move sorts instantiation to constructor in order
to maintain thread safety and prevent a potential race condition from memoization. Before this commit, freezing the search object ivar in the SortLink class to verify that it is not being mutated was raising errors due to this. @ernie, @radar, let me know if this isn’t a good idea.
This commit is contained in:
parent
d41779a489
commit
dd2679b6ab
|
@ -35,6 +35,7 @@ module Ransack
|
|||
@context, options[:grouping] || Constants::AND
|
||||
)
|
||||
@scope_args = {}
|
||||
@sorts ||= []
|
||||
build(params.with_indifferent_access)
|
||||
end
|
||||
|
||||
|
@ -83,7 +84,7 @@ module Ransack
|
|||
alias :s= :sorts=
|
||||
|
||||
def sorts
|
||||
@sorts ||= []
|
||||
@sorts
|
||||
end
|
||||
alias :s :sorts
|
||||
|
||||
|
|
Loading…
Reference in New Issue