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 def find_domain
domain_name = params[:parsed_frame].css('name').text.strip.downcase 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 unless @domain
epp_errors << { epp_errors << {

View file

@ -241,40 +241,52 @@ class Domain < ActiveRecord::Base
# rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/MethodLength
def update_whois_body def update_whois_body
self.whois_body = <<-EOS self.whois_body = <<-EOS
This Whois Server contains information on This Whois Server contains information on
Estonian Top Level Domain ee TLD Estonian Top Level Domain ee TLD
domain: #{name} domain: #{name}
registrar: #{registrar} registrar: #{registrar}
status: status:
registered: registered: #{registered_at and registered_at.to_s(:db)}
changed: #{updated_at.to_s(:db)} changed: #{updated_at and updated_at.to_s(:db)}
expire: expire:
outzone: outzone:
delete: delete:
contact #{contacts_body}
name:
e-mail:
registrar:
created:
contact: nsset:
nserver:
nsset: registrar: #{registrar}
nserver: phone: #{registrar.phone}
address: #{registrar.address}
registrar: created: #{registrar.created_at.to_s(:db)}
org: changed: #{registrar.updated_at.to_s(:db)}
url:
phone:
address:
created:
changed:
EOS EOS
end end
# rubocop:enabled Metrics/MethodLength # 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) def whois_server_update(name, whois_body)
wd = Whois::Domain.find_or_initialize_by(name: name) wd = Whois::Domain.find_or_initialize_by(name: name)
wd.whois_body = whois_body wd.whois_body = whois_body

View file

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