Tôi đang dùng Heroku với miền tùy chỉnh và tôi có tiện ích bổ sung Redis. Tôi cần trợ giúp để hiểu cách tạo nhân viên nền cho thông báo qua email. Người dùng có thể hộp thư đến với nhau và tôi muốn gửi thông báo qua email cho người dùng cho mỗi thư mới nhận được. Tôi có các thông báo làm việc trong phát triển, nhưng tôi không tốt với việc tạo ra các công việc nền được yêu cầu cho Heroku, nếu không thì máy chủ sẽ hết thời gian chờ.Hết giờ Heroku khi gửi email
Messages Bộ điều khiển: mô hình
def create
@recipient = User.find(params[:user])
current_user.send_message(@recipient, params[:body], params[:subject])
flash[:notice] = "Message has been sent!"
if request.xhr?
render :json => {:notice => flash[:notice]}
else
redirect_to :conversations
end
end
User:
def mailboxer_email(object)
if self.no_email
email
else
nil
end
end
Mailboxer.rb:
Mailboxer.setup do |config|
#Configures if you applications uses or no the email sending for Notifications and Messages
config.uses_emails = false
#Configures the default from for the email sent for Messages and Notifications of Mailboxer
config.default_from = "[email protected]"
#Configures the methods needed by mailboxer
config.email_method = :mailboxer_email
config.name_method = :name
#Configures if you use or not a search engine and wich one are you using
#Supported enignes: [:solr,:sphinx]
config.search_enabled = false
config.search_engine = :sphinx
end