Rails6、行动信箱设置

Rails 6 and action mailbox setup

我最近升级到 ruby 2.6.0p0 and rails 6.0.2.1。之前我有 ruby 2.3 and rails 5.2.

当我打开现有的应用程序时 bundle update 然后 rails s 一切正常:

=> Booting Puma
=> Rails 6.0.2.1 application starting in development 
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.6.0-p0), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development

但是当我尝试通过最初输入 rails action_mailbox:install 来实现新的 action mailbox 功能时 returns 出现以下错误,如果我输入 rails action_text:install.

rails aborted!
Don't know how to build task 'action_mailbox:install' (See the list of available tasks with `rails --tasks`)

知道为什么会这样吗?

如果找不到该任务,则通常是以下两种情况之一:

  1. 当您 运行 脚本时,您的终端正在使用不同版本的 rails(也许试试 bundle exec rails action_mailbox:install?)
  2. Upgrade Task 期间遗漏了一些不需要新操作邮箱任务的部分。

我遇到了同样的问题。 请确定,您需要 action_mailbox/engine in application.rb

require 'action_mailbox/engine'