Class: EmailAddress

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/email_address.rb

Instance Method Summary collapse

Instance Method Details

#primary=(value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/email_address.rb', line 6

def primary=(value)
  if value and not person.nil?
    person.email_addresses.each do |addr|
      if addr != self
        addr.primary = false
        addr.save
      end
    end
  end
  write_attribute(:primary, value)
end