2013-11-28 68 views
1

我嘗試使用新的軌道基於鋼軌4異步郵件指導here未定義的方法`異步=」對的ActionMailer :: Base的:類中軌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。我試圖耙我的工人,但耙子也將因此而失敗。

謝謝你的幫助。

回答

2

因此很明顯,他們從異步移動與外部隊列同步的,這種行爲是默認使用:

行動梅勒異步標誌使用同步IMPL

默認爲true

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

進一步更新:

顯然,他們拉了排隊功能,以及:

移至後臺作業的「工作」分支,直到完全成熟。沒有與Rails 4.0一起發貨。

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

+0

這很奇怪,因爲當我發送電子郵件時,我可以看到我的頁面正在加載並正在等待電子郵件被髮送 – Quantico

+1

我發佈了更新。顯然,沒有原生的帶外ActionMailer功能。不幸的是,你可能不得不用工人排隊系統來解決問題。 –

0

我不認爲它做到了!

[email protected]:~/tmp$ git clone [email protected]: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. 
[email protected]:~/tmp$ cd rails/ 

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

[email protected]:~/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 
+0

所以沒有內置的異步郵件:(嘆了口氣,你猜我將不得不尋找另一種方式來處理這個 – Quantico

+0

看看我的新的答案。顯然,這是同步的隊列,這是幾乎一樣好我想,你當然不希望超過1000個電子郵件同時發送你的CPU。 –

+0

我回答了另一個答案:) – Quantico

相關問題