mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 15:44:45 +02:00
Remove redundant functions
This commit is contained in:
parent
1bc0ec07d3
commit
55ae0dc0b7
2 changed files with 4 additions and 4 deletions
|
@ -511,14 +511,12 @@ class Contact < ApplicationRecord
|
||||||
def clear_address_modifications
|
def clear_address_modifications
|
||||||
return unless modifies_address?
|
return unless modifies_address?
|
||||||
|
|
||||||
addr_fields = %i[city street zip state country_code]
|
remove_address
|
||||||
addr_fields.each { |field| self[field] = nil }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def modifies_address?
|
def modifies_address?
|
||||||
addr_fields = %i[city street zip state country_code]
|
|
||||||
modified = false
|
modified = false
|
||||||
addr_fields.each { |field| modified = true if changes.key?(field) }
|
self.class.address_attribute_names.each { |field| modified = true if changes.key?(field) }
|
||||||
|
|
||||||
modified
|
modified
|
||||||
end
|
end
|
||||||
|
|
|
@ -152,6 +152,8 @@ class ContactTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_address
|
def test_address
|
||||||
|
Setting.address_processing = true
|
||||||
|
|
||||||
address = Contact::Address.new('new street', '83746', 'new city', 'new state', 'EE')
|
address = Contact::Address.new('new street', '83746', 'new city', 'new state', 'EE')
|
||||||
@contact.address = address
|
@contact.address = address
|
||||||
@contact.save!
|
@contact.save!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue