2011-02-12 57 views
1

这是我看到的错误执行到期:试图实现在Rails的注册,但是当表单提交

Timeout::Error in Devise/registrationsController#create 

execution expired 

这是我development.rb是什么样子:

MyApp::Application.configure do 
    # Settings specified here will take precedence over those in config/environment.rb 

    # In the development environment your application's code is reloaded on 
    # every request. This slows down response time but is perfect for development 
    # since you don't have to restart the webserver when you make code changes. 
    config.cache_classes = false 

    # Log error messages when you accidentally call methods on nil. 
    config.whiny_nils = true 

    # Show full error reports and disable caching 
    config.consider_all_requests_local  = true 
    config.action_view.debug_rjs    = true 
    config.action_controller.perform_caching = false 

    # Don't care if the mailer can't send 
    config.action_mailer.raise_delivery_errors = true 

    # Print deprecation notices to the Rails logger 
    config.active_support.deprecation = :log 

    # Only use best-standards-support built into browsers 
    config.action_dispatch.best_standards_support = :builtin 


    config.action_mailer.default_url_options = { :host => 'localhost:3000' } #Make sure to set 'host' to domain name in production. 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = false 
    config.action_mailer.raise_delivery_errors = true 
    config.action_mailer.default :charset => "utf-8" 

end 

检查我日志,这是我看到的,一旦我点击注册表单上的'提交'按钮:

Started GET "https://stackoverflow.com/users/register" for 127.0.0.1 at 2011-02-11 19:19:23 -0500 
    Processing by Devise::RegistrationsController#new as HTML 
nil 
Rendered devise/shared/_links.erb (2.4ms) 
Rendered devise/registrations/new.html.erb within layouts/application (98.1ms) 
Completed 200 OK in 160ms (Views: 109.0ms | ActiveRecord: 0.0ms) 


Started POST "/users" for 127.0.0.1 at 2011-02-11 19:20:03 -0500 
    Processing by Devise::RegistrationsController#create as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"qWs4IOH3L+GT/Sld8rZRlhXi8JM0pe0NtWG4Tn9XRIU=", "user"=>{"username"=>"marcamillion", "f_name"=>"marc", "l_name"=>"gayle", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "email"=>"[email protected]"}, "commit"=>"Register"} 
nil 
WARNING: Can't mass-assign protected attributes: f_name, l_name 
    User Load (0.2ms) SELECT "users"."id" FROM "users" WHERE (LOWER("users"."email") = LOWER('[email protected]')) LIMIT 1 
    User Load (0.1ms) SELECT "users"."id" FROM "users" WHERE (LOWER("users"."username") = LOWER('marcamillion')) LIMIT 1 
    CACHE (0.0ms) SELECT "users"."id" FROM "users" WHERE (LOWER("users"."email") = LOWER('[email protected]')) LIMIT 1 
    User Load (0.2ms) SELECT "users".* FROM "users" WHERE ("users"."confirmation_token" = 'DCo8QgqWQfnYWq20n5Uf') LIMIT 1 
    AREL (31.0ms) INSERT INTO "users" ("email", "encrypted_password", "password_salt", "reset_password_token", "remember_token", "remember_created_at", "sign_in_count", "current_sign_in_at", "last_sign_in_at", "current_sign_in_ip", "last_sign_in_ip", "username", "f_name", "l_name", "created_at", "updated_at", "invitation_token", "invitation_sent_at", "plan_id", "current_state", "confirmation_token", "confirmed_at", "confirmation_sent_at") VALUES ('[email protected]', '$2a$10$55hQTGZpUKbeT5n30/eyau96jf5zzd18t19jV/Y4g8Urou/El4vKy', '$2a$10$55hQTGZpUKbeT5n30/eyau', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'marcamillion', NULL, NULL, '2011-02-12 00:20:03.699983', '2011-02-12 00:20:03.699983', NULL, NULL, NULL, NULL, 'DCo8QgqWQfnYWq20n5Uf', NULL, '2011-02-12 00:20:03.699855') 
Rendered devise/mailer/confirmation_instructions.html.erb (1.0ms) 

Sent mail to [email protected] (30009ms) 
Date: Fri, 11 Feb 2011 19:20:03 -0500 
From: [email protected] 
To: [email protected] 
Message-ID: <[email protected]> 
Subject: Confirmation instructions 
Mime-Version: 1.0 
Content-Type: text/html; 
charset=UTF-8 
Content-Transfer-Encoding: 7bit 

<p>Welcome [email protected]!</p> 

<p>You can confirm your account through the link below:</p> 

<p><a href="http://localhost:3000/users/confirmation?confirmation_token=DCo8QgqWQfnYWq20n5Uf">Confirm my account</a></p> 
Completed in 30349ms 

Timeout::Error (execution expired): 
+0

你有本地主机上运行的SMTP服务器? – johnmcaliley 2011-02-12 00:41:25

+0

hrmm ....我从来没有明确地设置它。但是,就我而言,我认为我唯一必须拥有的是我的development.rb文件中的上述设置。如何检查SMTP服务器是否正在运行? – marcamillion 2011-02-12 00:51:07

回答

2

我假设你没有有一个SMTP服务器在本地运行。除非你真正需要的邮件开发交付,那么你可以删除这个东西,它不应该的错误你:

config.action_mailer.default_url_options = { :host => 'localhost:3000' } #Make sure to set 'host' to domain name in production. 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.perform_deliveries = false 
config.action_mailer.raise_delivery_errors = true 
config.action_mailer.default :charset => "utf-8" 

如果你想在开发中的邮件传递,然后谷歌设置SMTP服务器。或者你甚至可以使用像Gmail这样的东西作为SMTP服务器