我想fresh_when last_modified: @conversations.maximum(:updated_at)
与分页一起使用。但是,当@conversations
在第 2 页时,即使集合中有一条记录,也会updated_at
返回。nil
irb(mail):001:0> conversations = conversations.paginate(page: 1)
=> [10 conversations]
irb(main):002:0> conversations.maximum(:updated_at)
(3.0ms) SELECT MAX(`inbox_conversations`.`updated_at`) AS max_id FROM `inbox_conversations` LIMIT 10 OFFSET 0
=> 2013-01-09 05:12:10 UTC # Correct
irb(main):003:0> conversations = conversations.paginate(page: 2)
=> [10 conversations]
irb(main):004:0> conversations.maximum(:updated_at)
(2.7ms) SELECT MAX(`inbox_conversations`.`updated_at`) AS max_id FROM `inbox_conversations` LIMIT 10 OFFSET 10
=> nil # Not correct