is_contacted 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/is_contacted.rb +5 -4
  2. metadata +3 -3
data/lib/is_contacted.rb CHANGED
@@ -27,14 +27,15 @@ module IsContacted
27
27
 
28
28
  def update_contact
29
29
  unless self._contact.blank?
30
- _new_contact = Contact.find_by_value(self._contact)
30
+ _test_contact = Contact.build_for(:value =>self._contact)
31
+ _test_contact.valid?
32
+ _new_contact = Contact.find_by_value(_test_contact.value)
31
33
  if _new_contact
32
34
  self.contact_id = _new_contact.id
33
35
  self.user_id = _new_contact.user_id
34
36
  else
35
- _new_contact = Contact.build_for(:value =>self._contact)
36
- _new_contact.save
37
- self.contact_id = _new_contact.id
37
+ _test_contact.save
38
+ self.contact_id = _test_contact.id
38
39
  end
39
40
  end
40
41
  if contact_id.blank? && self.respond_to?(:user_id)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dieinzige
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-12 00:00:00 +03:00
17
+ date: 2010-03-16 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency