1

在本地机器上测试时出现一些奇怪的行为:

1) 首先,当我注册时,我被重定向到主页,我看到一条消息说:

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

当用户只是在正确的路径上创建帐户时,我发现看到警告类型的消息很奇怪。我可以轻松更改 /locales/devise.en.yml 中的消息,但我只是想确认这是设计的默认行为,而不是我的设置有什么问题?

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

它说“不可接受”?这意味着什么?是通过还是没通过?发生了什么?

4

1 回答 1

2

我想到了。显然,该链接在链接末尾包含一个“&format=”参数。电子邮件的设计视图正在注入 @resource 导致资源的 id 作为 url 的格式放入(在这种情况下它是空白的,因为我使用 params_to 和艺术家昵称作为 id,并且有一些我遇到的其他问题没有被填充......与这个问题无关)。我修复了视图,这解决了问题。

于 2011-09-28T21:08:24.883 回答