105842700-contact_and_domain_query_change

This commit is contained in:
Stas 2016-02-15 12:38:05 +02:00
parent 81a19983a7
commit e077ba7ee8
4 changed files with 37 additions and 7 deletions

View file

@ -1,14 +1,15 @@
class Registrant::ContactsController < RegistrantController
def show
@contact = Contact.where(id: contacts).find(params[:id])
@contact = Contact.where(id: contacts).find_by(id: params[:id])
@current_user = current_user
authorize! :read, @contact
end
def contacts
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
begin
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_contacts
DomainContact.where(domain_id: BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids).pluck(:contact_id)
rescue Soap::Arireg::NotAvailableError => error
flash[:notice] = I18n.t(error.json[:message])
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")