Merge pull request #184 from captbaritone/patch-1

Ensure messages are shown in the order they were recieved
This commit is contained in:
Samuel Cochran 2015-01-17 17:18:02 +11:00
commit e703dbcf13

View File

@ -69,7 +69,7 @@ module MailCatcher::Mail extend self
end
def messages
@messages_query ||= db.prepare "SELECT id, sender, recipients, subject, size, created_at FROM message ORDER BY created_at ASC"
@messages_query ||= db.prepare "SELECT id, sender, recipients, subject, size, created_at FROM message ORDER BY created_at, id ASC"
@messages_query.execute.map do |row|
Hash[row.fields.zip(row)].tap do |message|
message["recipients"] &&= ActiveSupport::JSON.decode message["recipients"]