mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Refactor Devise integration
- Use scoped users - Use the named route helpers instead of hardcoded paths
This commit is contained in:
parent
c31f507c25
commit
9684c8e59f
52 changed files with 313 additions and 280 deletions
|
@ -21,11 +21,11 @@ class Registrar
|
|||
end
|
||||
|
||||
if params[:statuses_contains]
|
||||
contacts = current_user.registrar.contacts.includes(:registrar).where(
|
||||
contacts = current_registrar_user.registrar.contacts.includes(:registrar).where(
|
||||
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
)
|
||||
else
|
||||
contacts = current_user.registrar.contacts.includes(:registrar)
|
||||
contacts = current_registrar_user.registrar.contacts.includes(:registrar)
|
||||
end
|
||||
|
||||
normalize_search_parameters do
|
||||
|
@ -45,7 +45,7 @@ class Registrar
|
|||
@contacts = Contact.find_by(name: params[:q][:name_matches])
|
||||
end
|
||||
|
||||
contacts = current_user.registrar.contacts.includes(:registrar)
|
||||
contacts = current_registrar_user.registrar.contacts.includes(:registrar)
|
||||
contacts = contacts.filter_by_states(params[:statuses_contains]) if params[:statuses_contains]
|
||||
|
||||
normalize_search_parameters do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue