email_campaign 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ class EmailCampaign::Campaign < ActiveRecord::Base
11
11
  # (falls back to #id if #subscriber_id doesn't exist; either way, id should be unique within campaign)
12
12
  def add_recipients(new_recipients, options = {})
13
13
  options.stringify_keys!
14
- new_recipients = [ new_recipients ] unless new_recipients.is_a?(Array)
14
+ new_recipients = [ new_recipients ] unless new_recipients.respond_to?(:each)
15
15
 
16
16
  processed = 0
17
17
  skipped = 0
@@ -35,7 +35,7 @@ class EmailCampaign::Campaign < ActiveRecord::Base
35
35
  end
36
36
 
37
37
  processed += 1
38
- r = recipients.build(:name => rcpt.name.strip, :email_address => rcpt.email_address.strip,
38
+ r = recipients.build(:name => rcpt.name, :email_address => rcpt.email_address,
39
39
  :subscriber_class_name => rcpt.class.name, :subscriber_id => subscriber_id)
40
40
  if r.save
41
41
  case
@@ -41,7 +41,7 @@ class EmailCampaign::Recipient < ActiveRecord::Base
41
41
  end
42
42
 
43
43
  def check_name
44
- self.name = nil if name.blank?
44
+ self.name = name.blank? ? nil : name.strip
45
45
 
46
46
  true
47
47
  end
@@ -58,6 +58,8 @@ class EmailCampaign::Recipient < ActiveRecord::Base
58
58
  end
59
59
 
60
60
  def check_email_address
61
+ self.email_address = email_address.blank? ? nil : email_address.strip
62
+
61
63
  if valid_email_address?(email_address)
62
64
  self.invalid_email = false
63
65
  else
@@ -1,3 +1,3 @@
1
1
  module EmailCampaign
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_campaign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionmailer