2011-09-28 15 views
1

我的本地機器上測試時我發現了一些奇怪的行爲:色器件報名確認凍結,當我點擊電子郵件確認鏈接

1)首先,當我註冊,我重定向到主頁我看到上面寫着閃光消息:

"You have signed up successfully. However, we could not sign you in because your account is unconfirmed." 

我覺得很奇怪地看到一條警告消息類型,當用戶僅僅是在正確的道路上,以創建一個帳戶。我可以很容易地更改/locales/devise.en.yml中的消息,但我只是想確認這是devise的默認行爲,而不是我的設置有問題?

2)我成功地收到一封電子郵件,確認鏈接:

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

<p><a href="http://localhost:5000/accounts/confirmation?confirmation_token=MywxHuW3PWHvg6x2nUfG&amp;format=">Confirm my account</a></p> 

當我點擊電子郵件確認鏈接,我看到一個空白網頁。

開發日誌顯示:

Started GET "/accounts/confirmation?confirmation_token=MywxHuW3PWHvg6x2nUfG&format=" for 127.0.0.1 at 2011-09-28 09:41:55 -0700 
    Processing by Devise::ConfirmationsController#show as 
    Parameters: {"confirmation_token"=>"MywxHuW3PWHvg6x2nUfG"} 
    SQL (0.9ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull 
FROM pg_attribute a LEFT JOIN pg_attrdef d 
ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
WHERE a.attrelid = '"artists"'::regclass 
AND a.attnum > 0 AND NOT a.attisdropped 
ORDER BY a.attnum 
    Artist Load (0.4ms) SELECT "artists".* FROM "artists" WHERE "artists"."confirmation_token" = 'MywxHuW3PWHvg6x2nUfG' LIMIT 1 
    SQL (0.8ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull 
    FROM pg_attribute a LEFT JOIN pg_attrdef d 
    ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
    WHERE a.attrelid = '"artists"'::regclass 
    AND a.attnum > 0 AND NOT a.attisdropped 
    ORDER BY a.attnum 
    SQL (0.2ms) BEGIN 
    AREL (0.9ms) UPDATE "artists" SET "confirmation_token" = NULL, "confirmed_at" = '2011-09-28 16:41:55.894603', "updated_at" = '2011-09-28 16:41:55.895467' WHERE "artists"."id" = 85 
    [paperclip] Saving attachments. 
    SQL (0.8ms) COMMIT 
    SQL (0.1ms) BEGIN 
    AREL (0.5ms) UPDATE "artists" SET "last_sign_in_at" = '2011-09-28 16:41:55.915779', "current_sign_in_at" = '2011-09-28 16:41:55.915779', "last_sign_in_ip" = '127.0.0.1', "current_sign_in_ip" = '127.0.0.1', "sign_in_count" = 1, "updated_at" = '2011-09-28 16:41:55.916532' WHERE "artists"."id" = 85 
    [paperclip] Saving attachments. 
    SQL (0.5ms) COMMIT 
    Completed 406 Not Acceptable in 231ms 

「不接受」 出來嗎?那是什麼意思?它是否通過?發生了什麼?

回答

2

我想通了。該鏈接顯然包含鏈接末尾的「& format =」參數。電子郵件的設計視圖注入了@資源,導致將資源的id作爲url的格式(在這種情況下它是空白的,因爲我使用了params_to和藝術家暱稱作爲id,並且有一些我遇到的其他問題沒有被填充......與此問題無關)。我修正了這些觀點並解決了問題。