Class: MailboxerNamespacingCompatibility

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/mailboxer/templates/mailboxer_namespacing_compatibility.rb

Class Method Summary collapse

Class Method Details

.downObject



11
12
13
14
15
16
17
18
# File 'lib/generators/mailboxer/templates/mailboxer_namespacing_compatibility.rb', line 11

def self.down
  rename_table :mailboxer_conversations, :conversations
  rename_table :mailboxer_notifications, :notifications
  rename_table :mailboxer_receipts,      :receipts

  Mailboxer::Notification.table_name = "notifications"
  Mailboxer::Notification.where(type: 'Mailboxer::Message').update_all(type: 'Message')
end

.upObject



3
4
5
6
7
8
9
# File 'lib/generators/mailboxer/templates/mailboxer_namespacing_compatibility.rb', line 3

def self.up
  rename_table :conversations, :mailboxer_conversations
  rename_table :notifications, :mailboxer_notifications
  rename_table :receipts,      :mailboxer_receipts

  Mailboxer::Notification.where(type: 'Message').update_all(type: 'Mailboxer::Message')
end