mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
changed contact has_many addresses to has_one
This commit is contained in:
parent
356835bebf
commit
27ca5714cd
5 changed files with 6 additions and 6 deletions
|
@ -9,7 +9,7 @@ module Epp::ContactsHelper
|
||||||
|
|
||||||
@contact.assign_attributes(name: ph[:postalInfo][:name])
|
@contact.assign_attributes(name: ph[:postalInfo][:name])
|
||||||
|
|
||||||
@contact.addresses << new_address
|
@contact.address = new_address
|
||||||
stamp @contact
|
stamp @contact
|
||||||
|
|
||||||
@contact.save
|
@contact.save
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Contact < ActiveRecord::Base
|
||||||
#TODO Foreign contact will get email with activation link/username/temp password
|
#TODO Foreign contact will get email with activation link/username/temp password
|
||||||
#TODO Phone number validation, in first phase very minimam in order to support current registries
|
#TODO Phone number validation, in first phase very minimam in order to support current registries
|
||||||
|
|
||||||
has_many :addresses
|
has_one :address
|
||||||
has_many :domain_contacts
|
has_many :domain_contacts
|
||||||
has_many :domains, through: :domain_contacts
|
has_many :domains, through: :domain_contacts
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ xml.epp_head do
|
||||||
xml.tag!('contact:name', @contact.name)
|
xml.tag!('contact:name', @contact.name)
|
||||||
xml.tag!('contact:org', @contact.org_name)
|
xml.tag!('contact:org', @contact.org_name)
|
||||||
xml.tag!('contact:addr') do
|
xml.tag!('contact:addr') do
|
||||||
xml.tag!('contact:street', @contact.addresses.first.street)
|
xml.tag!('contact:street', @contact.address.street)
|
||||||
xml.tag!('contact:street', @contact.addresses.first.city)
|
xml.tag!('contact:street', @contact.address.city)
|
||||||
end
|
end
|
||||||
xml.tag!('contact:voice', @contact.phone)
|
xml.tag!('contact:voice', @contact.phone)
|
||||||
xml.tag!('contact:fax', @contact.fax)
|
xml.tag!('contact:fax', @contact.fax)
|
||||||
|
|
|
@ -5,5 +5,5 @@ Fabricator(:contact) do
|
||||||
ident '37605030299'
|
ident '37605030299'
|
||||||
code 'sh8913'
|
code 'sh8913'
|
||||||
ident_type 'op'
|
ident_type 'op'
|
||||||
addresses(count: 2)
|
address
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe Contact do
|
describe Contact do
|
||||||
it { should have_many(:addresses) }
|
it { should have_one(:address) }
|
||||||
|
|
||||||
context 'with invalid attribute' do
|
context 'with invalid attribute' do
|
||||||
before(:each) { @contact = Fabricate(:contact) }
|
before(:each) { @contact = Fabricate(:contact) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue