简体   繁体   English

Rails 4中ActionMailer :: Base:Class的未定义方法'async ='

[英]undefined method `async=' for ActionMailer::Base:Class in rails 4

I am trying to use the new rails 4 asynchronous mailer based on the rails guide here 我正在尝试根据此处的rails指南使用新的Rails 4异步邮件程序

in my config/application.rb I added 在我的config / application.rb中我添加了

config.action_mailer.async = true

and in my actionMailer I added 在我的actionMailer中,我添加了

class welcomeMailer < ActionMailer::Base
    #self.async = true
end

these results in undefined method async= for ActionMailer::Base:Class when I try to run my rails server . 当我尝试运行rails server时,这些结果undefined method async= for ActionMailer::Base:Class产生undefined method async= for ActionMailer::Base:Class I tried to rake my workers but rake will also fail due to this addition. 我曾试图耙我的工人,但耙也将由于此增加而失败。

Thank you for your help. 谢谢您的帮助。

So apparently they moved from asynchronous to synchronous with an external queue, and this behavior is used by default: 因此,显然,它们从外部队列移到异步队列,然后变为同步队列,并且默认情况下使用以下行为:

Action Mailer async flag is true by default using a Synchronous impl 默认情况下,使用同步impl时,Action Mailer异步标志为true

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

Further update: 进一步更新:

Apparently they pulled the queuing functionality as well: 显然,他们也拉出了排队功能:

Move background jobs to the 'jobs' branch until fully baked. 将后台作业移至“作业”分支,直至完全烘焙。 Not shipping with Rails 4.0. 不随Rails 4.0一起提供。

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

I don't think it ever made it! 我认为它没有成功!

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/

The only mentions of 'async' are under active_record, action_view/actionpack or the guides. 关于“异步”的唯一提及是在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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM