Question

I am not sure if this has to do with the mailboxer gem or if this is something deeper in rails. Any time I click a link, all records from my messages table, conversations table, and receipts table are loaded. This happens even if the page has nothing to do with mailboxer. Does anyone know why this is or how I can fix it?

For example, no matter what page i go to, the following always appears in my server logs:

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]]

I am using active record, postgres, and rails 4.

Was it helpful?

Solution

It's hard to tell without looking at your code. Normally, the first thing I would do is check the before_filter calls in the ApplicationController class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top