ActionMailer :: Base的未定义方法`async =':rails 4中的类

时间:2013-11-28 15:51:52

标签: ruby-on-rails ruby-on-rails-4 actionmailer

我正在尝试使用基于rails指南here

的新rails 4异步邮件程序

在我的config / application.rb中我添加了

config.action_mailer.async = true

在我的actionMailer中我添加了

class welcomeMailer < ActionMailer::Base
    #self.async = true
end
当我尝试运行undefined method async= for ActionMailer::Base:Class时,

这些结果会导致rails server。我试图耙我的工人,但由于这个添加,rake也会失败。

感谢您的帮助。

2 个答案:

答案 0 :(得分:2)

显然,他们从异步移动到同步与外部队列,默认情况下使用此行为:

  

默认情况下,使用Synchronous impl

,Action Mailer async标志为true

https://github.com/rails/rails/commit/34b23e7110a3a13cf157608cefc9b5701017bf39

进一步更新:

显然他们也提取了排队功能:

  

将后台作业移至“作业”分支,直至完全烘焙。不随Rails 4.0一起发货。

https://github.com/rails/rails/commit/f9da785d0b1b22317cfca25c15fb555e9016accb

答案 1 :(得分:0)

我认为它没有成功!

farleyknight@farleyknight-desktop:~/tmp$ git clone git@github.com:rails/rails.git
Cloning into 'rails'...
remote: Finding bitmap roots...
remote: Counting objects: 394168, done.
remote: Compressing objects: 100% (110181/110181), done.
remote: Total 394168 (delta 286616), reused 387911 (delta 280577)
Receiving objects: 100% (394168/394168), 93.88 MiB | 1.61 MiB/s, done.
Resolving deltas: 100% (286616/286616), done.
farleyknight@farleyknight-desktop:~/tmp$ cd rails/

“async”的唯一提及是在active_record,action_view / actionpack或指南下。

farleyknight@farleyknight-desktop:~/tmp/rails$ grep async . -r --exclude=*.js
Binary file ./.git/objects/pack/pack-2684dbd9d8af432c397e766784fb5ca058fec4c4.pack matches
./.git/packed-refs:61e31f2c8744eccd07c23d3fad2db9ea8504909b refs/remotes/origin/async
Binary file ./.git/index matches
./activerecord/test/cases/locking_test.rb:# (See exec vs. async_exec in the PostgreSQL adapter.)
./activerecord/lib/active_record/explain.rb:    # asynchronously by the subscriber and returned.
./activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:            result_as_array @connection.async_exec(sql)
./activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:            @connection.async_exec(sql)
./activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:          log(sql, name, binds) { @connection.async_exec(sql) }
./actionview/lib/action_view/helpers/tag_helper.rb:                           autoplay controls loop selected hidden scoped async
./guides/source/security.md:NOTE: _Make sure file uploads don't overwrite important files, and process media files asynchronously._
./guides/source/security.md:The solution to this is best to _process media files asynchronously_: Save the media file and schedule a processing request in the database. A second process will handle the processing of the file in the background.
./guides/source/form_helpers.md:Unlike other forms making an asynchronous file upload form is not as simple as providing `form_for` with `remote: true`. With an Ajax form the serialization is done by JavaScript running inside the browser and since JavaScript cannot read files from your hard drive the file cannot be uploaded. The most common workaround is to use an invisible iframe that serves as the target for the form submission.
./actionpack/test/controller/live_stream_test.rb:    def test_async_stream