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
@@ -0,0 +1,24 @@
1
+ class MailboxerNamespacingCompatibility < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ rename_table :conversations, :mailboxer_conversations
5
+ rename_table :notifications, :mailboxer_notifications
6
+ rename_table :receipts, :mailboxer_receipts
7
+
8
+ if Rails.version < '4'
9
+ rename_index :mailboxer_notifications, :notifications_on_conversation_id, :mailboxer_notifications_on_conversation_id
10
+ rename_index :mailboxer_receipts, :receipts_on_notification_id, :mailboxer_receipts_on_notification_id
11
+ end
12
+ end
13
+
14
+ def self.down
15
+ rename_table :mailboxer_conversations, :conversations
16
+ rename_table :mailboxer_notifications, :notifications
17
+ rename_table :mailboxer_receipts, :receipts
18
+
19
+ if Rails.version < '4'
20
+ rename_index :notifications, :mailboxer_notifications_on_conversation_id, :notifications_on_conversation_id
21
+ rename_index :receipts, :mailboxer_receipts_on_notification_id, :receipts_on_notification_id
22
+ end
23
+ end
24
+ end
data/lib/mailboxer.rb CHANGED
@@ -17,8 +17,13 @@ module Mailboxer
17
17
  @@email_method = :mailboxer_email
18
18
  mattr_accessor :name_method
19
19
  @@name_method = :name
20
+ mattr_accessor :subject_max_length
21
+ @@subject_max_length = 255
22
+ mattr_accessor :body_max_length
23
+ @@body_max_length = 32000
20
24
  mattr_accessor :notification_mailer
21
25
  mattr_accessor :message_mailer
26
+ mattr_accessor :custom_deliver_proc
22
27
 
23
28
  class << self
24
29
  def setup
@@ -34,4 +39,5 @@ end
34
39
  # reopen ActiveRecord and include all the above to make
35
40
  # them available to all our models if they want it
36
41
  require 'mailboxer/engine'
37
- require 'mailboxer/concerns/configurable_mailer'
42
+ require 'mailboxer/cleaner'
43
+ require 'mailboxer/mail_dispatcher'
@@ -0,0 +1,9 @@
1
+ require 'singleton'
2
+
3
+ module Mailboxer
4
+ class Cleaner
5
+ include Singleton
6
+ include ActionView::Helpers::SanitizeHelper
7
+
8
+ end
9
+ end
@@ -10,7 +10,7 @@ module Mailboxer
10
10
  class Engine < Rails::Engine
11
11
  initializer "mailboxer.models.messageable" do
12
12
  ActiveSupport.on_load(:active_record) do
13
- extend Mailboxer::Models::Messageable::ActiveRecord
13
+ extend Mailboxer::Models::Messageable::ActiveRecordExtension
14
14
  end
15
15
  end
16
16
  end
@@ -0,0 +1,48 @@
1
+ module Mailboxer
2
+ class MailDispatcher
3
+
4
+ attr_reader :mailable, :recipients
5
+
6
+ def initialize(mailable, recipients)
7
+ @mailable, @recipients = mailable, recipients
8
+ end
9
+
10
+ def call
11
+ return false unless Mailboxer.uses_emails
12
+ if Mailboxer.mailer_wants_array
13
+ send_email(filtered_recipients)
14
+ else
15
+ filtered_recipients.each do |recipient|
16
+ email_to = recipient.send(Mailboxer.email_method, mailable)
17
+ send_email(recipient) if email_to.present?
18
+ end
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def mailer
25
+ klass = mailable.class.name.demodulize
26
+ method = "#{klass.downcase}_mailer".to_sym
27
+ Mailboxer.send(method) || "#{mailable.class}Mailer".constantize
28
+ end
29
+
30
+ # recipients can be filtered on a conversation basis
31
+ def filtered_recipients
32
+ return recipients unless mailable.respond_to?(:conversation)
33
+
34
+ recipients.each_with_object([]) do |recipient, array|
35
+ array << recipient if mailable.conversation.has_subscriber?(recipient)
36
+ end
37
+ end
38
+
39
+ def send_email(recipient)
40
+ if Mailboxer.custom_deliver_proc
41
+ Mailboxer.custom_deliver_proc.call(mailer, mailable, recipient)
42
+ else
43
+ mailer.send_email(mailable, recipient).deliver
44
+ end
45
+ end
46
+
47
+ end
48
+ end
@@ -3,7 +3,7 @@ module Mailboxer
3
3
  module Messageable
4
4
  extend ActiveSupport::Concern
5
5
 
6
- module ActiveRecord
6
+ module ActiveRecordExtension
7
7
  #Converts the model into messageable allowing it to interchange messages and
8
8
  #receive notifications
9
9
  def acts_as_messageable
@@ -11,13 +11,14 @@ module Mailboxer
11
11
  end
12
12
  end
13
13
 
14
+
14
15
  included do
15
- has_many :messages, :as => :sender
16
+ has_many :messages, :class_name => "Mailboxer::Message", :as => :sender
16
17
  if Rails::VERSION::MAJOR == 4
17
- has_many :receipts, -> { order 'created_at DESC' }, dependent: :destroy, as: :receiver
18
+ has_many :receipts, -> { order 'created_at DESC' }, :class_name => "Mailboxer::Receipt", dependent: :destroy, as: :receiver
18
19
  else
19
20
  # Rails 3 does it this way
20
- has_many :receipts, :order => 'created_at DESC', :dependent => :destroy, :as => :receiver
21
+ has_many :receipts, :order => 'created_at DESC', :class_name => "Mailboxer::Receipt", :dependent => :destroy, :as => :receiver
21
22
  end
22
23
  end
23
24
 
@@ -46,20 +47,20 @@ module Mailboxer
46
47
 
47
48
  #Gets the mailbox of the messageable
48
49
  def mailbox
49
- @mailbox = Mailbox.new(self) if @mailbox.nil?
50
+ @mailbox = Mailboxer::Mailbox.new(self) if @mailbox.nil?
50
51
  @mailbox.type = :all
51
52
  @mailbox
52
53
  end
53
54
 
54
55
  #Sends a notification to the messageable
55
56
  def notify(subject,body,obj = nil,sanitize_text=true,notification_code=nil,send_mail=true)
56
- Notification.notify_all([self],subject,body,obj,sanitize_text,notification_code,send_mail)
57
+ Mailboxer::Notification.notify_all([self],subject,body,obj,sanitize_text,notification_code,send_mail)
57
58
  end
58
59
 
59
60
  #Sends a messages, starting a new conversation, with the messageable
60
61
  #as originator
61
62
  def send_message(recipients, msg_body, subject, sanitize_text=true, attachment=nil, message_timestamp = Time.now)
62
- convo = Conversation.new({:subject => subject})
63
+ convo = Mailboxer::Conversation.new({:subject => subject})
63
64
  convo.created_at = message_timestamp
64
65
  convo.updated_at = message_timestamp
65
66
  message = messages.new({:body => msg_body, :subject => subject, :attachment => attachment})
@@ -115,11 +116,11 @@ module Mailboxer
115
116
  #* An array with any of them
116
117
  def mark_as_read(obj)
117
118
  case obj
118
- when Receipt
119
+ when Mailboxer::Receipt
119
120
  obj.mark_as_read if obj.receiver == self
120
- when Message, Notification
121
+ when Mailboxer::Message, Mailboxer::Notification
121
122
  obj.mark_as_read(self)
122
- when Conversation
123
+ when Mailboxer::Conversation
123
124
  obj.mark_as_read(self)
124
125
  when Array
125
126
  obj.map{ |sub_obj| mark_as_read(sub_obj) }
@@ -136,11 +137,11 @@ module Mailboxer
136
137
  #* An array with any of them
137
138
  def mark_as_unread(obj)
138
139
  case obj
139
- when Receipt
140
+ when Mailboxer::Receipt
140
141
  obj.mark_as_unread if obj.receiver == self
141
- when Message, Notification
142
+ when Mailboxer::Message, Mailboxer::Notification
142
143
  obj.mark_as_unread(self)
143
- when Conversation
144
+ when Mailboxer::Conversation
144
145
  obj.mark_as_unread(self)
145
146
  when Array
146
147
  obj.map{ |sub_obj| mark_as_unread(sub_obj) }
@@ -180,11 +181,11 @@ module Mailboxer
180
181
  #* An array with any of them
181
182
  def trash(obj)
182
183
  case obj
183
- when Receipt
184
+ when Mailboxer::Receipt
184
185
  obj.move_to_trash if obj.receiver == self
185
- when Message, Notification
186
+ when Mailboxer::Message, Mailboxer::Notification
186
187
  obj.move_to_trash(self)
187
- when Conversation
188
+ when Mailboxer::Conversation
188
189
  obj.move_to_trash(self)
189
190
  when Array
190
191
  obj.map{ |sub_obj| trash(sub_obj) }
@@ -201,11 +202,11 @@ module Mailboxer
201
202
  #* An array with any of them
202
203
  def untrash(obj)
203
204
  case obj
204
- when Receipt
205
+ when Mailboxer::Receipt
205
206
  obj.untrash if obj.receiver == self
206
- when Message, Notification
207
+ when Mailboxer::Message, Mailboxer::Notification
207
208
  obj.untrash(self)
208
- when Conversation
209
+ when Mailboxer::Conversation
209
210
  obj.untrash(self)
210
211
  when Array
211
212
  obj.map{ |sub_obj| untrash(sub_obj) }
@@ -213,7 +214,7 @@ module Mailboxer
213
214
  end
214
215
 
215
216
  def search_messages(query)
216
- @search = Receipt.search do
217
+ @search = Mailboxer::Receipt.search do
217
218
  fulltext query
218
219
  with :receiver_id, self.id
219
220
  end
@@ -0,0 +1,3 @@
1
+ module Mailboxer
2
+ VERSION = "0.12.0.rc1"
3
+ end
data/mailboxer.gemspec CHANGED
@@ -1,12 +1,17 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'mailboxer/version'
4
+
1
5
  Gem::Specification.new do |s|
2
6
  s.name = "mailboxer"
3
- s.version = "0.11.0"
7
+ s.version = Mailboxer::VERSION
8
+
4
9
  s.authors = ["Eduardo Casanova Cuesta"]
5
10
  s.summary = "Messaging system for rails apps."
6
11
  s.description = "A Rails engine that allows any model to act as messageable, adding the ability to exchange messages " +
7
12
  "with any other messageable model, even different ones. It supports the use of conversations with " +
8
- "two or more recipients to organize the messages. You have a complete use of a mailbox object for " +
9
- "each messageable model that manages an inbox, sentbox and trash for conversations. It also supports " +
13
+ "two or more recipients to organize the messages. You have a complete use of a mailbox object for " +
14
+ "each messageable model that manages an inbox, sentbox and trash for conversations. It also supports " +
10
15
  "sending notifications to messageable models, intended to be used as system notifications."
11
16
  s.email = "ecasanovac@gmail.com"
12
17
  s.homepage = "https://github.com/ging/mailboxer"
@@ -19,15 +24,18 @@ Gem::Specification.new do |s|
19
24
  s.add_runtime_dependency('foreigner', '>= 0.9.1')
20
25
 
21
26
  # Development Gem dependencies
22
- s.add_runtime_dependency('rails', '> 3.0.0')
27
+ s.add_runtime_dependency('rails', '>= 3.2.0')
23
28
  s.add_runtime_dependency('carrierwave', '>= 0.5.8')
24
- # Debugging
25
- if RUBY_VERSION < '1.9'
26
- s.add_development_dependency('ruby-debug', '>= 0.10.3')
29
+
30
+ if RUBY_ENGINE == "rbx" && RUBY_VERSION >= "2.1.0"
31
+ # Rubinius has it's own dependencies
32
+ s.add_runtime_dependency 'rubysl'
33
+ s.add_development_dependency 'racc'
27
34
  end
28
35
  # Specs
29
36
  s.add_development_dependency('rspec-rails', '>= 2.6.1')
30
- s.add_development_dependency("appraisal")
37
+ s.add_development_dependency('appraisal', '~> 1.0.0')
38
+ s.add_development_dependency('shoulda-matchers')
31
39
  # Fixtures
32
40
  #if RUBY_VERSION >= '1.9.2'
33
41
  # s.add_development_dependency('factory_girl', '>= 3.0.0')
data/spec/dummy/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '~> 3.0.0'
3
+ gem 'rails', '~> 4.1.0'
4
4
  gem 'mailboxer', :path => '../../'
5
5
  gem 'factory_girl'
6
6
 
@@ -2,9 +2,9 @@ class Duck < ActiveRecord::Base
2
2
  acts_as_messageable
3
3
  def mailboxer_email(object)
4
4
  case object
5
- when Message
5
+ when Mailboxer::Message
6
6
  return nil
7
- when Notification
7
+ when Mailboxer::Notification
8
8
  return email
9
9
  end
10
10
  end
@@ -14,4 +14,8 @@ Mailboxer.setup do |config|
14
14
  #Supported enignes: [: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
@@ -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
27
+ t.references :notified_object, :polymorphic => true
28
+ t.string :notification_code, :default => nil
28
29
  t.column :conversation_id, :integer
29
30
  t.column :draft, :boolean, :default => false
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
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  # This file is auto-generated from the current state of the database. Instead
2
3
  # of editing this file, please use the migrations feature of Active Record to
3
4
  # incrementally modify your database, and then regenerate this schema definition.
@@ -10,47 +11,55 @@
10
11
  #
11
12
  # It's strongly recommended to check this file into your version control system.
12
13
 
13
- ActiveRecord::Schema.define(:version => 20120305103203) do
14
-
15
- create_table "conversations", :force => true do |t|
16
- t.string "subject", :default => ""
17
- t.datetime "created_at", :null => false
18
- t.datetime "updated_at", :null => false
19
- end
14
+ ActiveRecord::Schema.define(:version => 20131206080416) do
20
15
 
21
16
  create_table "cylons", :force => true do |t|
22
17
  t.string "name"
23
18
  t.string "email"
24
- t.datetime "created_at", :null => false
25
- t.datetime "updated_at", :null => false
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
26
21
  end
27
22
 
28
23
  create_table "ducks", :force => true do |t|
29
24
  t.string "name"
30
25
  t.string "email"
31
- t.datetime "created_at", :null => false
32
- t.datetime "updated_at", :null => false
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ create_table "mailboxer_conversation_opt_outs", :force => true do |t|
31
+ t.integer "unsubscriber_id"
32
+ t.string "unsubscriber_type"
33
+ t.integer "conversation_id"
34
+ end
35
+
36
+ create_table "mailboxer_conversations", :force => true do |t|
37
+ t.string "subject", :default => ""
38
+ t.datetime "created_at", :null => false
39
+ t.datetime "updated_at", :null => false
33
40
  end
34
41
 
35
- create_table "notifications", :force => true do |t|
42
+ create_table "mailboxer_notifications", :force => true do |t|
36
43
  t.string "type"
37
44
  t.text "body"
38
45
  t.string "subject", :default => ""
39
46
  t.integer "sender_id"
40
47
  t.string "sender_type"
41
- t.integer "conversation_id"
42
- t.boolean "draft", :default => false
43
- t.datetime "updated_at", :null => false
44
- t.datetime "created_at", :null => false
45
48
  t.integer "notified_object_id"
46
49
  t.string "notified_object_type"
47
50
  t.string "notification_code"
51
+ t.integer "conversation_id"
52
+ t.boolean "draft", :default => false
48
53
  t.string "attachment"
54
+ t.datetime "updated_at", :null => false
55
+ t.datetime "created_at", :null => false
56
+ t.boolean "global", :default => false
57
+ t.datetime "expires"
49
58
  end
50
59
 
51
- add_index "notifications", ["conversation_id"], :name => "index_notifications_on_conversation_id"
60
+ add_index "mailboxer_notifications", ["conversation_id"], :name => "index_mailboxer_notifications_on_conversation_id"
52
61
 
53
- create_table "receipts", :force => true do |t|
62
+ create_table "mailboxer_receipts", :force => true do |t|
54
63
  t.integer "receiver_id"
55
64
  t.string "receiver_type"
56
65
  t.integer "notification_id", :null => false
@@ -62,13 +71,13 @@ ActiveRecord::Schema.define(:version => 20120305103203) do
62
71
  t.datetime "updated_at", :null => false
63
72
  end
64
73
 
65
- add_index "receipts", ["notification_id"], :name => "index_receipts_on_notification_id"
74
+ add_index "mailboxer_receipts", ["notification_id"], :name => "index_mailboxer_receipts_on_notification_id"
66
75
 
67
76
  create_table "users", :force => true do |t|
68
77
  t.string "name"
69
78
  t.string "email"
70
- t.datetime "created_at", :null => false
71
- t.datetime "updated_at", :null => false
79
+ t.datetime "created_at"
80
+ t.datetime "updated_at"
72
81
  end
73
82
 
74
83
  end