Refactor country

This commit is contained in:
Martin Lensment 2015-02-02 12:07:59 +02:00
parent 195aa4a890
commit b86e2d1edb
3 changed files with 8 additions and 8 deletions

View file

@ -9,8 +9,8 @@ class User < ActiveRecord::Base
validates :username, :password, presence: true
validates :identity_code, uniqueness: true, allow_blank: true
validates :identity_code, presence: true, if: -> { country.iso == 'EE' }
validates :email, presence: true, if: -> { country.iso != 'EE' }
validates :identity_code, presence: true, if: -> { country.alpha2 == 'EE' }
validates :email, presence: true, if: -> { country.alpha2 != 'EE' }
validate :validate_identity_code

View file

@ -5,7 +5,7 @@ xml.tag!('contact:postalInfo', type: 'int') do
if @disclosure.try(:addr) || @owner
xml.tag!('contact:addr') do
xml.tag!('contact:street', address.street) if address
xml.tag!('contact:cc', address.try(:country).try(:iso)) unless address.try(:country).nil?
xml.tag!('contact:cc', address.country_code) unless address.country_code.nil?
xml.tag!('contact:city', address.city) if address
end
end