我不确定这是否与邮箱gem有关,或者这是否在rails中更深层次。每次单击链接时,都会加载来自我的消息表,会话表和收据表的所有记录。即使页面与邮箱无关,也会发生这种情况。有谁知道这是为什么或我如何解决它?
例如,无论我去哪个页面,我的服务器日志中都会出现以下内容:
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.