mailboxer 0.11.0 → 0.12.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +4 -3
  4. data/Appraisals +6 -14
  5. data/Gemfile +1 -1
  6. data/README.md +2 -2
  7. data/app/mailers/mailboxer/base_mailer.rb +14 -0
  8. data/app/mailers/{message_mailer.rb → mailboxer/message_mailer.rb} +9 -14
  9. data/app/mailers/mailboxer/notification_mailer.rb +17 -0
  10. data/app/models/mailboxer/conversation.rb +196 -0
  11. data/app/models/mailboxer/conversation/opt_out.rb +15 -0
  12. data/app/models/{mailbox.rb → mailboxer/mailbox.rb} +10 -10
  13. data/app/models/mailboxer/message.rb +49 -0
  14. data/app/models/{notification.rb → mailboxer/notification.rb} +44 -40
  15. data/app/models/{receipt.rb → mailboxer/receipt.rb} +12 -11
  16. data/app/views/{message_mailer → mailboxer/message_mailer}/new_message_email.html.erb +3 -3
  17. data/app/views/{message_mailer → mailboxer/message_mailer}/new_message_email.text.erb +2 -2
  18. data/app/views/{message_mailer → mailboxer/message_mailer}/reply_message_email.html.erb +3 -3
  19. data/app/views/{message_mailer → mailboxer/message_mailer}/reply_message_email.text.erb +2 -2
  20. data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.html.erb +0 -0
  21. data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.text.erb +0 -0
  22. data/db/migrate/20110511145103_create_mailboxer.rb +18 -14
  23. data/db/migrate/20131206080416_add_conversation_optout.rb +14 -0
  24. data/gemfiles/rails3.2.gemfile +2 -3
  25. data/gemfiles/rails4.0.gemfile +3 -4
  26. data/gemfiles/rails4.1.gemfile +7 -0
  27. data/lib/generators/mailboxer/install_generator.rb +1 -4
  28. data/lib/generators/mailboxer/namespacing_compatibility_generator.rb +22 -0
  29. data/lib/generators/mailboxer/templates/initializer.rb +8 -4
  30. data/lib/generators/mailboxer/templates/mailboxer_namespacing_compatibility.rb +24 -0
  31. data/lib/mailboxer.rb +7 -1
  32. data/lib/mailboxer/cleaner.rb +9 -0
  33. data/lib/mailboxer/engine.rb +1 -1
  34. data/lib/mailboxer/mail_dispatcher.rb +48 -0
  35. data/lib/mailboxer/models/messageable.rb +21 -20
  36. data/lib/mailboxer/version.rb +3 -0
  37. data/mailboxer.gemspec +16 -8
  38. data/spec/dummy/Gemfile +1 -1
  39. data/spec/dummy/app/models/duck.rb +2 -2
  40. data/spec/dummy/config/initializers/mailboxer.rb +4 -0
  41. data/spec/dummy/db/migrate/20120305103200_create_mailboxer.rb +18 -14
  42. data/spec/dummy/db/migrate/20131206080416_add_conversation_optout.rb +14 -0
  43. data/spec/dummy/db/schema.rb +30 -21
  44. data/spec/integration/message_and_receipt_spec.rb +212 -212
  45. data/spec/mailboxer/mail_dispatcher_spec.rb +114 -0
  46. data/spec/mailers/message_mailer_spec.rb +4 -4
  47. data/spec/mailers/notification_mailer_spec.rb +2 -2
  48. data/spec/models/conversation_spec.rb +148 -47
  49. data/spec/models/mailbox_spec.rb +50 -50
  50. data/spec/models/mailboxer_models_messageable_spec.rb +52 -52
  51. data/spec/models/message_spec.rb +1 -1
  52. data/spec/models/notification_spec.rb +50 -18
  53. data/spec/models/receipt_spec.rb +1 -1
  54. data/spec/spec_helper.rb +3 -0
  55. metadata +68 -57
  56. data/app/mailers/notification_mailer.rb +0 -21
  57. data/app/models/conversation.rb +0 -166
  58. data/app/models/message.rb +0 -68
  59. data/db/migrate/20110719110700_add_notified_object.rb +0 -17
  60. data/db/migrate/20110912163911_add_notification_code.rb +0 -13
  61. data/db/migrate/20111204163911_add_attachments.rb +0 -9
  62. data/db/migrate/20120813110712_rename_receipts_read.rb +0 -9
  63. data/db/migrate/20130305144212_add_global_notification_support.rb +0 -9
  64. data/gemfiles/rails3.0.gemfile +0 -8
  65. data/gemfiles/rails3.1.gemfile +0 -8
  66. data/lib/mailboxer/concerns/configurable_mailer.rb +0 -13
  67. data/spec/dummy/db/migrate/20120305103201_add_notified_object.rb +0 -17
  68. data/spec/dummy/db/migrate/20120305103202_add_notification_code.rb +0 -13
  69. data/spec/dummy/db/migrate/20120305103203_add_attachments.rb +0 -5
  70. data/spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb +0 -9
  71. data/spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb +0 -11
  72. data/spec/mailboxer/concerns/configurable_mailer_spec.rb +0 -27
@@ -1,40 +1,42 @@
1
- class Notification < ActiveRecord::Base
1
+ class Mailboxer::Notification < ActiveRecord::Base
2
+ self.table_name = :mailboxer_notifications
3
+
2
4
  attr_accessor :recipients
3
5
  attr_accessible :body, :subject, :global, :expires if Mailboxer.protected_attributes?
4
6
 
5
7
  belongs_to :sender, :polymorphic => :true
6
8
  belongs_to :notified_object, :polymorphic => :true
7
- has_many :receipts, :dependent => :destroy
9
+ has_many :receipts, :dependent => :destroy, :class_name => "Mailboxer::Receipt"
8
10
 
9
- validates_presence_of :subject, :body
11
+ validates :subject, :presence => true,
12
+ :length => { :maximum => Mailboxer.subject_max_length }
13
+ validates :body, :presence => true,
14
+ :length => { :maximum => Mailboxer.body_max_length }
10
15
 
11
16
  scope :recipient, lambda { |recipient|
12
- joins(:receipts).where('receipts.receiver_id' => recipient.id,'receipts.receiver_type' => recipient.class.base_class.to_s)
17
+ joins(:receipts).where('mailboxer_receipts.receiver_id' => recipient.id,'mailboxer_receipts.receiver_type' => recipient.class.base_class.to_s)
13
18
  }
14
19
  scope :with_object, lambda { |obj|
15
20
  where('notified_object_id' => obj.id,'notified_object_type' => obj.class.to_s)
16
21
  }
17
22
  scope :not_trashed, lambda {
18
- joins(:receipts).where('receipts.trashed' => false)
23
+ joins(:receipts).where('mailboxer_receipts.trashed' => false)
19
24
  }
20
25
  scope :unread, lambda {
21
- joins(:receipts).where('receipts.is_read' => false)
26
+ joins(:receipts).where('mailboxer_receipts.is_read' => false)
22
27
  }
23
28
  scope :global, lambda { where(:global => true) }
24
- scope :expired, lambda { where("notifications.expires < ?", Time.now) }
29
+ scope :expired, lambda { where("mailboxer_notifications.expires < ?", Time.now) }
25
30
  scope :unexpired, lambda {
26
- where("notifications.expires is NULL OR notifications.expires > ?", Time.now)
31
+ where("mailboxer_notifications.expires is NULL OR mailboxer_notifications.expires > ?", Time.now)
27
32
  }
28
33
 
29
- include Concerns::ConfigurableMailer
30
-
31
34
  class << self
32
35
  #Sends a Notification to all the recipients
33
36
  def notify_all(recipients,subject,body,obj = nil,sanitize_text = true,notification_code=nil,send_mail=true)
34
- notification = Notification.new({:body => body, :subject => subject})
35
- notification.recipients = recipients.respond_to?(:each) ? recipients : [recipients]
36
- notification.recipients = notification.recipients.uniq if recipients.respond_to?(:uniq)
37
- notification.notified_object = obj if obj.present?
37
+ notification = Mailboxer::Notification.new({:body => body, :subject => subject})
38
+ notification.recipients = Array(recipients).uniq
39
+ notification.notified_object = obj if obj.present?
38
40
  notification.notification_code = notification_code if notification_code.present?
39
41
  notification.deliver sanitize_text, send_mail
40
42
  end
@@ -43,7 +45,7 @@ class Notification < ActiveRecord::Base
43
45
  #successful or +false+ if some error raised
44
46
  def successful_delivery? receipts
45
47
  case receipts
46
- when Receipt
48
+ when Mailboxer::Receipt
47
49
  receipts.valid?
48
50
  receipts.errors.empty?
49
51
  when Array
@@ -75,30 +77,20 @@ class Notification < ActiveRecord::Base
75
77
  #Delivers a Notification. USE NOT RECOMENDED.
76
78
  #Use Mailboxer::Models::Message.notify and Notification.notify_all instead.
77
79
  def deliver(should_clean = true, send_mail = true)
78
- self.clean if should_clean
80
+ clean if should_clean
79
81
  temp_receipts = Array.new
82
+
80
83
  #Receiver receipts
81
84
  self.recipients.each do |r|
82
- msg_receipt = Receipt.new
83
- msg_receipt.notification = self
84
- msg_receipt.is_read = false
85
- msg_receipt.receiver = r
86
- temp_receipts << msg_receipt
85
+ temp_receipts << build_receipt(r, nil, false)
87
86
  end
88
- temp_receipts.each(&:valid?)
89
- if temp_receipts.all? { |t| t.errors.empty? }
87
+
88
+ if temp_receipts.all?(&:valid?)
90
89
  temp_receipts.each(&:save!) #Save receipts
91
- self.recipients.each do |r|
92
- #Should send an email?
93
- if Mailboxer.uses_emails
94
- email_to = r.send(Mailboxer.email_method,self)
95
- if send_mail && !email_to.blank?
96
- get_mailer.send_email(self,r).deliver
97
- end
98
- end
99
- end
100
- self.recipients=nil
90
+ Mailboxer::MailDispatcher.new(self, recipients).call if send_mail
91
+ self.recipients = nil
101
92
  end
93
+
102
94
  return temp_receipts if temp_receipts.size > 1
103
95
  temp_receipts.first
104
96
  end
@@ -119,7 +111,7 @@ class Notification < ActiveRecord::Base
119
111
 
120
112
  #Returns the receipt for the participant
121
113
  def receipt_for(participant)
122
- Receipt.notification(self).recipient(participant)
114
+ Mailboxer::Receipt.notification(self).recipient(participant)
123
115
  end
124
116
 
125
117
  #Returns the receipt for the participant. Alias for receipt_for(participant)
@@ -179,14 +171,10 @@ class Notification < ActiveRecord::Base
179
171
  return self.receipt_for(participant).mark_as_deleted
180
172
  end
181
173
 
182
- include ActionView::Helpers::SanitizeHelper
183
-
184
174
  #Sanitizes the body and subject
185
175
  def clean
186
- unless self.subject.nil?
187
- self.subject = sanitize self.subject
188
- end
189
- self.body = sanitize self.body
176
+ self.subject = sanitize(subject) if subject
177
+ self.body = sanitize(body)
190
178
  end
191
179
 
192
180
  #Returns notified_object. DEPRECATED
@@ -194,4 +182,20 @@ class Notification < ActiveRecord::Base
194
182
  warn "DEPRECATION WARNING: use 'notify_object' instead of 'object' to get the object associated with the Notification"
195
183
  notified_object
196
184
  end
185
+
186
+ def sanitize(text)
187
+ ::Mailboxer::Cleaner.instance.sanitize(text)
188
+ end
189
+
190
+ private
191
+
192
+ def build_receipt(receiver, mailbox_type, is_read = false)
193
+ Mailboxer::Receipt.new.tap do |receipt|
194
+ receipt.notification = self
195
+ receipt.is_read = is_read
196
+ receipt.receiver = receiver
197
+ receipt.mailbox_type = mailbox_type
198
+ end
199
+ end
200
+
197
201
  end
@@ -1,9 +1,10 @@
1
- class Receipt < ActiveRecord::Base
1
+ class Mailboxer::Receipt < ActiveRecord::Base
2
+ self.table_name = :mailboxer_receipts
2
3
  attr_accessible :trashed, :is_read, :deleted if Mailboxer.protected_attributes?
3
4
 
4
- belongs_to :notification, :validate => true, :autosave => true
5
+ belongs_to :notification, :class_name => "Mailboxer::Notification", :validate => true, :autosave => true
5
6
  belongs_to :receiver, :polymorphic => :true
6
- belongs_to :message, :foreign_key => "notification_id"
7
+ belongs_to :message, :class_name => "Mailboxer::Message", :foreign_key => "notification_id"
7
8
 
8
9
  validates_presence_of :receiver
9
10
 
@@ -12,13 +13,13 @@ class Receipt < ActiveRecord::Base
12
13
  }
13
14
  #Notifications Scope checks type to be nil, not Notification because of STI behaviour
14
15
  #with the primary class (no type is saved)
15
- scope :notifications_receipts, lambda { joins(:notification).where('notifications.type' => nil) }
16
- scope :messages_receipts, lambda { joins(:notification).where('notifications.type' => Message.to_s) }
16
+ scope :notifications_receipts, lambda { joins(:notification).where('mailboxer_notifications.type' => nil) }
17
+ scope :messages_receipts, lambda { joins(:notification).where('mailboxer_notifications.type' => Mailboxer::Message.to_s) }
17
18
  scope :notification, lambda { |notification|
18
19
  where(:notification_id => notification.id)
19
20
  }
20
21
  scope :conversation, lambda { |conversation|
21
- joins(:message).where('notifications.conversation_id' => conversation.id)
22
+ joins(:message).where('mailboxer_notifications.conversation_id' => conversation.id)
22
23
  }
23
24
  scope :sentbox, lambda { where(:mailbox_type => "sentbox") }
24
25
  scope :inbox, lambda { where(:mailbox_type => "inbox") }
@@ -86,7 +87,7 @@ class Receipt < ActiveRecord::Base
86
87
  condition << "OR id = ? "
87
88
  end
88
89
  conditions[0] = condition
89
- Receipt.except(:where).except(:joins).where(conditions).update_all(updates)
90
+ Mailboxer::Receipt.except(:where).except(:joins).where(conditions).update_all(updates)
90
91
  end
91
92
  end
92
93
  end
@@ -134,7 +135,7 @@ class Receipt < ActiveRecord::Base
134
135
 
135
136
  #Returns the conversation associated to the receipt if the notification is a Message
136
137
  def conversation
137
- message.conversation if message.is_a? Message
138
+ message.conversation if message.is_a? Mailboxer::Message
138
139
  end
139
140
 
140
141
  #Returns if the participant have read the Notification
@@ -152,9 +153,9 @@ class Receipt < ActiveRecord::Base
152
153
  #Removes the duplicate error about not present subject from Conversation if it has been already
153
154
  #raised by Message
154
155
  def remove_duplicate_errors
155
- if self.errors["notification.conversation.subject"].present? and self.errors["notification.subject"].present?
156
- self.errors["notification.conversation.subject"].each do |msg|
157
- self.errors["notification.conversation.subject"].delete(msg)
156
+ if self.errors["mailboxer_notification.conversation.subject"].present? and self.errors["mailboxer_notification.subject"].present?
157
+ self.errors["mailboxer_notification.conversation.subject"].each do |msg|
158
+ self.errors["mailboxer_notification.conversation.subject"].delete(msg)
158
159
  end
159
160
  end
160
161
  end
@@ -4,7 +4,7 @@
4
4
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
5
  </head>
6
6
  <body>
7
- <h1>You have a new message: <%= @message.subject.html_safe? ? @message.subject : strip_tags(@message.subject) %></h1>
7
+ <h1>You have a new message: <%= @subject %></h1>
8
8
  <p>
9
9
  You have received a new message:
10
10
  </p>
@@ -14,7 +14,7 @@
14
14
  </p>
15
15
  </blockquote>
16
16
  <p>
17
- Visit <%= link_to root_url,root_url %> and go to your inbox for more info.
17
+ Visit <%= link_to root_url, root_url %> and go to your inbox for more info.
18
18
  </p>
19
19
  </body>
20
- </html>
20
+ </html>
@@ -1,6 +1,6 @@
1
- You have a new message: <%= @message.subject.html_safe? ? @message.subject : strip_tags(@message.subject) %>
1
+ You have a new message: <%= @subject %>
2
2
  ===============================================
3
-
3
+
4
4
  You have received a new message:
5
5
 
6
6
  -----------------------------------------------
@@ -4,7 +4,7 @@
4
4
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
5
  </head>
6
6
  <body>
7
- <h1>You have a new reply: <%= @message.subject.html_safe? ? @message.subject : strip_tags(@message.subject) %></h1>
7
+ <h1>You have a new reply: <%= @subject %></h1>
8
8
  <p>
9
9
  You have received a new reply:
10
10
  </p>
@@ -14,7 +14,7 @@
14
14
  </p>
15
15
  </blockquote>
16
16
  <p>
17
- Visit <%= link_to root_url,root_url %> and go to your inbox for more info.
17
+ Visit <%= link_to root_url, root_url %> and go to your inbox for more info.
18
18
  </p>
19
19
  </body>
20
- </html>
20
+ </html>
@@ -1,6 +1,6 @@
1
- You have a new reply: <%= @message.subject.html_safe? ? @message.subject : strip_tags(@message.subject) %>
1
+ You have a new reply: <%= @subject %>
2
2
  ===============================================
3
-
3
+
4
4
  You have received a new reply:
5
5
 
6
6
  -----------------------------------------------
@@ -2,16 +2,16 @@ class CreateMailboxer < ActiveRecord::Migration
2
2
  def self.up
3
3
  #Tables
4
4
  #Conversations
5
- create_table :conversations do |t|
5
+ create_table :mailboxer_conversations do |t|
6
6
  t.column :subject, :string, :default => ""
7
7
  t.column :created_at, :datetime, :null => false
8
8
  t.column :updated_at, :datetime, :null => false
9
9
  end
10
10
  #Receipts
11
- create_table :receipts do |t|
11
+ create_table :mailboxer_receipts do |t|
12
12
  t.references :receiver, :polymorphic => true
13
13
  t.column :notification_id, :integer, :null => false
14
- t.column :read, :boolean, :default => false
14
+ t.column :is_read, :boolean, :default => false
15
15
  t.column :trashed, :boolean, :default => false
16
16
  t.column :deleted, :boolean, :default => false
17
17
  t.column :mailbox_type, :string, :limit => 25
@@ -19,43 +19,47 @@ class CreateMailboxer < ActiveRecord::Migration
19
19
  t.column :updated_at, :datetime, :null => false
20
20
  end
21
21
  #Notifications and Messages
22
- create_table :notifications do |t|
22
+ create_table :mailboxer_notifications do |t|
23
23
  t.column :type, :string
24
24
  t.column :body, :text
25
25
  t.column :subject, :string, :default => ""
26
26
  t.references :sender, :polymorphic => true
27
- t.references :object, :polymorphic => true
28
27
  t.column :conversation_id, :integer
29
28
  t.column :draft, :boolean, :default => false
29
+ t.string :notification_code, :default => nil
30
+ t.references :notified_object, :polymorphic => true
31
+ t.column :attachment, :string
30
32
  t.column :updated_at, :datetime, :null => false
31
33
  t.column :created_at, :datetime, :null => false
34
+ t.boolean :global, default: false
35
+ t.datetime :expires
32
36
  end
33
37
 
34
38
 
35
39
  #Indexes
36
40
  #Conversations
37
41
  #Receipts
38
- add_index "receipts","notification_id"
42
+ add_index "mailboxer_receipts","notification_id"
39
43
 
40
44
  #Messages
41
- add_index "notifications","conversation_id"
45
+ add_index "mailboxer_notifications","conversation_id"
42
46
 
43
47
  #Foreign keys
44
48
  #Conversations
45
49
  #Receipts
46
- add_foreign_key "receipts", "notifications", :name => "receipts_on_notification_id"
50
+ add_foreign_key "mailboxer_receipts", "mailboxer_notifications", :name => "receipts_on_notification_id", :column => "notification_id"
47
51
  #Messages
48
- add_foreign_key "notifications", "conversations", :name => "notifications_on_conversation_id"
52
+ add_foreign_key "mailboxer_notifications", "mailboxer_conversations", :name => "notifications_on_conversation_id", :column => "conversation_id"
49
53
  end
50
54
 
51
55
  def self.down
52
56
  #Tables
53
- remove_foreign_key "receipts", :name => "receipts_on_notification_id"
54
- remove_foreign_key "notifications", :name => "notifications_on_conversation_id"
57
+ remove_foreign_key "mailboxer_receipts", :name => "receipts_on_notification_id"
58
+ remove_foreign_key "mailboxer_notifications", :name => "notifications_on_conversation_id"
55
59
 
56
60
  #Indexes
57
- drop_table :receipts
58
- drop_table :conversations
59
- drop_table :notifications
61
+ drop_table :mailboxer_receipts
62
+ drop_table :mailboxer_conversations
63
+ drop_table :mailboxer_notifications
60
64
  end
61
65
  end
@@ -0,0 +1,14 @@
1
+ class AddConversationOptout < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :mailboxer_conversation_opt_outs do |t|
4
+ t.references :unsubscriber, :polymorphic => true
5
+ t.references :conversation
6
+ end
7
+ add_foreign_key "mailboxer_conversation_opt_outs", "mailboxer_conversations", :name => "mb_opt_outs_on_conversations_id", :column => "conversation_id"
8
+ end
9
+
10
+ def self.down
11
+ remove_foreign_key "mailboxer_conversation_opt_outs", :name => "mb_opt_outs_on_conversations_id"
12
+ drop_table :mailboxer_conversation_opt_outs
13
+ end
14
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 3.2.6"
6
- gem "mailboxer", :path=>"../"
5
+ gem "rails", "~> 3.2.17"
7
6
 
8
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -1,8 +1,7 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source "https://rubygems.org"
4
4
 
5
- gem "rails", ">=4.0.0"
6
- gem "mailboxer", :path=>"../"
5
+ gem "rails", "~> 4.0.4"
7
6
 
8
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~> 4.1.0"
6
+
7
+ gemspec :path => "../"
@@ -18,10 +18,7 @@ class Mailboxer::InstallGenerator < Rails::Generators::Base #:nodoc:
18
18
 
19
19
  def copy_migrations
20
20
  if Rails.version < "3.1"
21
- migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"],
22
- ["20110719110700_add_notified_object.rb","add_notified_object.rb"],
23
- ["20110912163911_add_notification_code.rb","add_notification_code.rb"],
24
- ["20111204163911_add_attachments.rb","add_attachments.rb"]]
21
+ migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"], ["20131206080416_add_conversation_optout.rb","add_conversation_optout.rb"]],
25
22
  migrations.each do |migration|
26
23
  migration_template "../../../../db/migrate/" + migration[0], "db/migrate/" + migration[1]
27
24
  end
@@ -0,0 +1,22 @@
1
+ class Mailboxer::NamespacingCompatibilityGenerator < Rails::Generators::Base
2
+ include Rails::Generators::Migration
3
+ source_root File.expand_path('../templates', __FILE__)
4
+ require 'rails/generators/migration'
5
+
6
+ FILENAME = 'mailboxer_namespacing_compatibility.rb'
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ def create_model_file
11
+ migration_template FILENAME, "db/migrate/#{FILENAME}"
12
+ end
13
+
14
+ def self.next_migration_number path
15
+ unless @prev_migration_nr
16
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
17
+ else
18
+ @prev_migration_nr += 1
19
+ end
20
+ @prev_migration_nr.to_s
21
+ end
22
+ end
@@ -1,17 +1,21 @@
1
1
  Mailboxer.setup do |config|
2
2
 
3
- #Configures if you applications uses or no the email sending for Notifications and Messages
3
+ #Configures if you application uses or not email sending for Notifications and Messages
4
4
  config.uses_emails = true
5
5
 
6
- #Configures the default from for the email sent for Messages and Notifications of Mailboxer
6
+ #Configures the default from for emails sent for Messages and Notifications
7
7
  config.default_from = "no-reply@mailboxer.com"
8
8
 
9
9
  #Configures the methods needed by mailboxer
10
10
  config.email_method = :mailboxer_email
11
11
  config.name_method = :name
12
12
 
13
- #Configures if you use or not a search engine and wich one are you using
14
- #Supported enignes: [:solr,:sphinx]
13
+ #Configures if you use or not a search engine and which one you are using
14
+ #Supported engines: [:solr,:sphinx]
15
15
  config.search_enabled = false
16
16
  config.search_engine = :solr
17
+
18
+ #Configures maximum length of the message subject and body
19
+ config.subject_max_length = 255
20
+ config.body_max_length = 32000
17
21
  end