【发布时间】:2011-08-11 22:35:31
【问题描述】:
好的,Rails 菜鸟问一个问题。我第一次尝试在这里做 Rails。我正在阅读 Agile Web Dev with Rails 第 4 版。我的生产箱出现此错误。 这在 webrick 下的开发模式下工作,我收到一封电子邮件发送到我的 gmail 帐户和 evrything 但在生产模式下的 apache 盒子上我收到此错误...
Errno::ECONNREFUSED in OrdersController#create
Connection refused - connect(2)
应用程序跟踪是...
app/controllers/orders_controller.rb:58:in `create'
app/controllers/orders_controller.rb:54:in `create'
这里是 app/controllers/order_controller.rb 中的 def create
def create
@order = Order.new(params[:order])
@order.add_line_items_from_cart(current_cart)
respond_to do |format| #THIS IS LINE 54
if @order.save
Cart.destroy(session[:cart_id])
session[:cart_id] = nil
Notifier.order_received(@order).deliver #THIS IS LINE 58
format.html { redirect_to(store_url, :notice => I18n.t('.thanks')) }
format.xml { render :xml => @order, :status => :created, :location => @order }
else
format.html { render :action => "new" }
format.xml { render :xml => @order.errors, :status => :unprocessable_entity }
end
end
我的第 58 行和第 54 行有什么问题?这是否与我在 app/config/environment.rb 中的 action_mailer 设置有关?
这里是 environment.rb
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Depot::Application.initialize!
#uncertain about anything below this line
Depot::Application.configure do
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:authentication => "plain",
:user_name => "myemail@gmail.com",
:password => "<password>",
:enable_starttls_auto => true
}
end
感谢任何帮助。谢谢。
【问题讨论】:
标签: ruby-on-rails ruby