-1

I am using Mailboxer on my Rails app, and don't want to get all messages in an conversation at once. How can I only get the last N messages in an conversation?

4

1 回答 1

1

我从未使用过 Mailboxer,但查看文档和代码应该可以使用常规 ActiveRecord 方法来限制消息。

给定 a conversation,这将获得最后 10 条消息:

conversation.messages.order('created_at DESC').limit(10)
于 2015-01-07T11:48:42.770 回答