2011-02-12 55 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服務器