Ruby on rails 关于会话id的通知不存在mailboxer rails问题

Ruby on rails 关于会话id的通知不存在mailboxer rails问题,ruby-on-rails,ruby-on-rails-3,ruby-on-rails-3.2,mailboxer,Ruby On Rails,Ruby On Rails 3,Ruby On Rails 3.2,Mailboxer,我升级了mailboxer gem,并按照文档中从0.11到0.12的步骤进行操作: $ rails generate mailboxer:namespacing_compatibility create db/migrate/20140707050845_mailboxer_namespacing_compatibility.rb $ rails generate mailboxer:install -s skip config/initializers/mailboxer

我升级了mailboxer gem,并按照文档中从0.11到0.12的步骤进行操作:

$ rails generate mailboxer:namespacing_compatibility
    create  db/migrate/20140707050845_mailboxer_namespacing_compatibility.rb
$ rails generate mailboxer:install -s
    skip  config/initializers/mailboxer.rb
    Copied migration 20140707050855_add_conversation_optout.mailboxer_engine.rb from mailboxer_engine
然后当我试着

$ rake db:migrate
这给了我一个错误

PG::UndefinedTable: ERROR:  relation "notifications_on_conversation_id" does not exist
有什么建议吗?如何修复


谢谢

我从mailboxer 0.9.0升级到0.12.4(在rails 3.2.19上)时遇到了同样的问题

我所做的是手动编辑由
namespacing\u compatibility
生成器创建的迁移,如下所示:

  • 在向上迁移中,我在
    rename\u index
    命令中将“from”索引名的前缀加上了“index”
  • 在向下迁移中,我同样重命名了“to”索引名
  • 同样在向下迁移中,我发现我需要将
    update\u all
    命令移到开头,在
    rename\u table
    命令之前
我编辑的迁移结果是这样的。在这里,我已经用注释说明了编辑过的行

class MailboxerNamespacingCompatibility < ActiveRecord::Migration

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

    if Rails.version < '4'
      # i edited the next two lines by adding the index_ prefix
      rename_index :mailboxer_notifications, :index_notifications_on_conversation_id, :mailboxer_notifications_on_conversation_id 
      rename_index :mailboxer_receipts,      :index_receipts_on_notification_id,      :mailboxer_receipts_on_notification_id 
    end

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

  def self.down
    # i moved this line from the end of the down block to here
    Mailboxer::Notification.where(type: 'Mailboxer::Message').update_all(type: 'Message')

    rename_table :mailboxer_conversations, :conversations
    rename_table :mailboxer_notifications, :notifications
    rename_table :mailboxer_receipts,      :receipts

    if Rails.version < '4'
      # i edited the next two lines by adding the index_ prefix
      rename_index :notifications, :mailboxer_notifications_on_conversation_id, :index_notifications_on_conversation_id
      rename_index :receipts,      :mailboxer_receipts_on_notification_id,      :index_receipts_on_notification_id
    end
  end
end
class MailboxerNamePacingCompatibility

然后我运行了迁移,运行了另一个(mailboxer:install)生成器,并运行了迁移。到目前为止,一切似乎正常。

嗯……我看到了错误,但看不出确切的原因……因此可能是一个sintaxis,也可能是检查真正的文件问题