Updated bullet issue for Domain create

This commit is contained in:
Priit Tark 2015-03-31 16:00:30 +03:00
parent 0533d16028
commit c5860bde98
3 changed files with 6 additions and 6 deletions

View file

@ -156,7 +156,7 @@ class Epp::DomainsController < EppController
def find_domain
domain_name = params[:parsed_frame].css('name').text.strip.downcase
@domain = Epp::Domain.where(name: domain_name).first
@domain = Epp::Domain.where(name: domain_name).includes(owner_contact: :registrar).first
unless @domain
epp_errors << {

View file

@ -68,11 +68,8 @@ class Epp::Domain < Domain
end
def attach_default_contacts
# for bullet, owner contact validates registrar and triggers bullet
owner_contact_included = Contact.where(id: owner_contact.id).includes(:registrar).first
tech_contacts << owner_contact_included if tech_contacts.blank?
admin_contacts << owner_contact_included if admin_contacts.blank? && owner_contact.priv?
tech_contacts << owner_contact if tech_contacts.blank?
admin_contacts << owner_contact if admin_contacts.blank? && owner_contact.priv?
end
# rubocop: disable Metrics/PerceivedComplexity

View file

@ -50,5 +50,8 @@ Rails.application.configure do
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs
Bullet.unused_eager_loading_enable = false
# Currenty hard to fix, it is triggered by Epp::Domain.new_from_epp for create request
Bullet.add_whitelist type: :n_plus_one_query, class_name: 'Contact', association: :registrar
end
end