fix policy scope errors in search controller (#947)
This commit is contained in:
parent
01cd624bfa
commit
d2074ada79
1 changed files with 4 additions and 2 deletions
|
@ -105,6 +105,7 @@ class SearchController < ApplicationController
|
||||||
builder = builder.where(user: user) if user
|
builder = builder.where(user: user) if user
|
||||||
@maps = builder.order(:name)
|
@maps = builder.order(:name)
|
||||||
else
|
else
|
||||||
|
skip_policy_scope
|
||||||
@maps = []
|
@maps = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -120,10 +121,10 @@ class SearchController < ApplicationController
|
||||||
term = term[7..-1] if term.downcase[0..6] == 'mapper:'
|
term = term[7..-1] if term.downcase[0..6] == 'mapper:'
|
||||||
search = term.downcase.strip + '%'
|
search = term.downcase.strip + '%'
|
||||||
|
|
||||||
skip_policy_scope # TODO: builder = policy_scope(User)
|
builder = policy_scope(User).where('LOWER("name") like ?', search)
|
||||||
builder = User.where('LOWER("name") like ?', search)
|
|
||||||
@mappers = builder.order(:name)
|
@mappers = builder.order(:name)
|
||||||
else
|
else
|
||||||
|
skip_policy_scope
|
||||||
@mappers = []
|
@mappers = []
|
||||||
end
|
end
|
||||||
render json: autocomplete_user_array_json(@mappers).to_json
|
render json: autocomplete_user_array_json(@mappers).to_json
|
||||||
|
@ -146,6 +147,7 @@ class SearchController < ApplicationController
|
||||||
@synapses = @one + @two
|
@synapses = @one + @two
|
||||||
@synapses.sort! { |s1, s2| s1.desc <=> s2.desc }.to_a
|
@synapses.sort! { |s1, s2| s1.desc <=> s2.desc }.to_a
|
||||||
else
|
else
|
||||||
|
skip_policy_scope
|
||||||
@synapses = []
|
@synapses = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue