domain bullet updated

This commit is contained in:
Priit Tark 2015-03-27 14:45:56 +02:00
parent 2d92971222
commit 8a4519d83e
3 changed files with 44 additions and 27 deletions

View file

@ -153,7 +153,11 @@ class Epp::DomainsController < EppController
def find_domain
domain_name = params[:parsed_frame].css('name').text.strip.downcase
@domain = Epp::Domain.find_by(name: domain_name)
if params[:action] == 'transfer'
@domain = Epp::Domain.includes(:registrar).where(name: domain_name).first
else
@domain = Epp::Domain.where(name: domain_name).first
end
unless @domain
epp_errors << {

View file

@ -247,34 +247,46 @@ class Domain < ActiveRecord::Base
domain: #{name}
registrar: #{registrar}
status:
registered:
changed: #{updated_at.to_s(:db)}
registered: #{registered_at and registered_at.to_s(:db)}
changed: #{updated_at and updated_at.to_s(:db)}
expire:
outzone:
delete:
contact
name:
e-mail:
registrar:
created:
contact:
#{contacts_body}
nsset:
nserver:
registrar:
org:
url:
phone:
address:
created:
changed:
registrar: #{registrar}
phone: #{registrar.phone}
address: #{registrar.address}
created: #{registrar.created_at.to_s(:db)}
changed: #{registrar.updated_at.to_s(:db)}
EOS
end
# rubocop:enabled Metrics/MethodLength
def contacts_body
out = ''
admin_contacts.includes(:registrar).each do |c|
out << 'Admin contact:'
out << "name: #{c.name}"
out << "email: #{c.email}"
out << "registrar: #{c.registrar}"
out << "created: #{c.created_at.to_s(:db)}"
end
tech_contacts.includes(:registrar).each do |c|
out << 'Tech contact:'
out << "name: #{c.name}"
out << "email: #{c.email}"
out << "registrar: #{c.registrar}"
out << "created: #{c.created_at.to_s(:db)}"
end
out
end
def whois_server_update(name, whois_body)
wd = Whois::Domain.find_or_initialize_by(name: name)
wd.whois_body = whois_body

View file

@ -49,5 +49,6 @@ Rails.application.configure do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs
# Bullet.unused_eager_loading_enable = false
end
end