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

tobben24
  • 1
  • 1

1 Answers1

0

I have never used Mailboxer, but looking at the docs and code it should be possible to limit messages using regular ActiveRecord methods.

Given a conversation, this would get the last 10 messages:

conversation.messages.order('created_at DESC').limit(10)
zwippie
  • 15,050
  • 3
  • 39
  • 54