首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >数据库中的记录在未被调用时加载。

数据库中的记录在未被调用时加载。
EN

Stack Overflow用户
提问于 2014-02-21 21:37:54
回答 1查看 36关注 0票数 1

我不确定这是否与邮筒宝石有关,或者这是否是rails中的更深层次的东西。每当我单击一个链接时,我的邮件表、会话表和收据表中的所有记录都会被加载。即使页面与mailboxer无关,也会发生这种情况。有谁知道这是为什么或者我怎么能修好它吗?

例如,无论我转到哪个页面,以下内容总是出现在服务器日志中:

代码语言:javascript
复制
Receipt Load (0.3ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 80]]
Receipt Load (0.3ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 80]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 78]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 78]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 75]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 75]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 69]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 69]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 67]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 67]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 66]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 66]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 65]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 65]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 63]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 63]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 60]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 60]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 55]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 55]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 51]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 51]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 46]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 46]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 45]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 45]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 44]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 44]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 42]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 42]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 41]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 41]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 39]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 39]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 38]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 38]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 37]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 37]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 43]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 43]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 32]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 32]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 31]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 31]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 29]]
Receipt Load (0.2ms)  SELECT "receipts".* FROM "receipts" WHERE "receipts"."notification_id" = $1 AND (receiver_id = 32) ORDER BY "receipts"."id" ASC LIMIT 1  [["notification_id", 29]]

我正在使用活动记录、postgres和rails 4。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-21 21:45:50

如果不查看您的代码,很难判断。通常,我要做的第一件事是检查ApplicationController类中的ApplicationController调用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21945688

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档