Hello.I have a question. I am making chat application to practice RoR.
I have three models. User, Chat, and Message.
The relationship is that User has many chats(it means chat’s host) and
message,s Chat has many messages.
Now I want to create a lobby page like this.
This page shows all chats sorted by the last message’s created_at. each
chat shows who is chat’s host, and what the last message is.
Is there any good way to get resource by ActiveRecord’s method?
Besides, the amount of messages will be huge,so is there good way to get
all chats which have the last message by loading LIMIT 1 message?