Messaging with Rails and Mailboxer

Well, once again withot seeing the code I can’t give some exact advices, but if you already have those ids, then you just utilize hidden_field_tag (http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-hidden_field_tag) to save those values, and then in controller just access params hash and look for the key with the proper name.

hidden_field_tag 'buyer_id', id

I can’t really say more here. You can contact me via e-mail and send some code pieces so that we can discuss more

I figured it out. Thank you again for you kind help. You have been fantastic and so has this tutorial. Keep up the great work.

Great!

Hi There,

I’ve spent a couple hours knocking myself in the head. I’ve followed the tutorial as exact as I could, adding in conversations and messages. I’m right before the Add Gravatar section…

When I try to go http://localhost:3000/conversations/new, I get an error

undefined local variable or method `get_mailbox' for #<ConversationsController:0x007fb64e862548>

Is there something that’s been updated or missing from the tutorial?

Thanks!

Hrm. Could you please check your ConversationsController with the one presented here https://github.com/bodrovis/SitePoint-Mailboxer/blob/master/app/controllers/conversations_controller.rb ? If everything is the same, please open a new issue https://github.com/bodrovis/SitePoint-Mailboxer/issues and provide the full error stack trace, I’ll look into it.

Great tutorial.
Thanks for sharing it.
I just found some detail missing concerning I18n in the conversation helper.
I had to add t() to title in link_to. All the rest remaining the same.

… link_to(t(title).capitalize …

With this, I only had to add the ‘inbox’, ‘sent’, trash’ keys to my translations file and everthing worked fine.
:thumbsup:

Oh, thanks for pointing that out!

Amazing tutorial!!.

My thanks :smile:

Am I the only person that doesn’t have the outgoing messages showing up in the sent folder or am I just dumb?

Well, no one has reported such issue, but by all means let’s look intro it. Any errors? Does your code match the one that is provided on GitHub https://github.com/bodrovis/SitePoint-Mailboxer? Maybe using other version of Mailboxer?

I think Mailboxer is a large solution. Recommend beginning from scrap. There is a tutorial for Rails two.0 here which ought to give you an idea . please follow this link http://web.archive.org/web/20100823114059/http://www.novawave.net/public/rails_messaging_tutorial.html

Well, I am sorry, but using Rails 2 now that Rails 5 is announced is probably not the best idea :smile:

Hi Ilya,

Sorry to pester. I have everything working except the empty button will not work despite having the same code as you :frowning:

When I try to use the empty button I get a message that says “Resource not found”. Any idea where I can focus my attention?

That’s interesting. Full error stack trace would be nice. You may open a new issue on GitHub if that’s more convenient for you :smile:

How to Write a Migration which can add on location attribute to a column in Mailbox messages : right now conversations have body and subject - i want to add location to it :slight_smile: thanks in advanced!

I believe this is the migration you are looking for https://github.com/bodrovis/SitePoint-Mailboxer/blob/master/db/migrate/20141208140641_create_mailboxer.mailboxer_engine.rb#L23 (just alter it after running rails g mailboxer:install).

You can add: rails g migration add_admin_to_user admin:string this would mean you would have to manually authorize someone in the console

Thanks for the quick response!

I ran // rails g migration add_fields_to_mailboxer_notification location:string // added params[:message][:location] to the message_controller.rb // then added the fields in the new conversation message form fields. I don’t get an error - Then in the conversation show it dose not show the added fields - nothing shows or happens

Gitrepo: https://github.com/Alloffices/MailboxApp

In the rails c how do ie: conversations.last or messages.find(1)

Great tutorial, thank you for writing. Though I ran into two issues.

  1. I get an error when sending messages: wrong number of arguments (1 for 0)
    It points to this line in the messages_controller:
    conversation = current_user.send_message(recipients, params[:message][:body], params[:message][:subject]).conversation

Here is a stack trace:

Started POST "/messages" for 10.0.2.2 at 2015-10-10 16:23:39 +0000
Processing by MessagesController#create as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"YiqT94X0gvp2W9aT1PNTx6iRM3E40ozMlkgZsU6LGpfoBxTygHFdBSkeyUYHHwGwWX+x8QpjJTEj4HYyrqhxng==", "message"=>{"subject"=>"work", "body"=>"pleas work this time!"}, "recipients"=>["2"], "commit"=>"Send"}
User Load (0.2ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2
(0.2ms)  BEGIN
SQL (0.7ms)  INSERT INTO "mailboxer_conversations" ("subject", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"  [["subject", "work"], ["created_at", "2015-10-10 16:23:39.424583"], ["updated_at", "2015-10-10 16:23:39.424583"]]
SQL (0.3ms)  INSERT INTO "mailboxer_notifications" ("type", "sender_id", "sender_type", "body", "subject", "created_at", "updated_at", "conversation_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"  [["type", "Mailboxer::Message"], ["sender_id", 1], ["sender_type", "User"], ["body", "pleas work this time!"], ["subject", "work"], ["created_at", "2015-10-10 16:23:39.424583"], ["updated_at", "2015-10-10 16:23:39.424583"], ["conversation_id", 10]]
SQL (0.2ms)  INSERT INTO "mailboxer_receipts" ("mailbox_type", "receiver_id", "receiver_type", "notification_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"  [["mailbox_type", "inbox"], ["receiver_id", 2], ["receiver_type", "User"], ["notification_id", 12], ["created_at", "2015-10-10 16:23:39.436761"], ["updated_at", "2015-10-10 16:23:39.436761"]]
(0.8ms)  COMMIT
(0.3ms)  BEGIN
SQL (0.2ms)  INSERT INTO "mailboxer_receipts" ("mailbox_type", "receiver_id", "receiver_type", "is_read", "notification_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"  [["mailbox_type", "sentbox"], ["receiver_id", 1], ["receiver_type", "User"], ["is_read", "t"], ["notification_id", 12], ["created_at", "2015-10-10 16:23:39.441001"], ["updated_at", "2015-10-10 16:23:39.441001"]]
(0.5ms)  COMMIT
(0.2ms)  SELECT COUNT(*) FROM "mailboxer_conversation_opt_outs" WHERE "mailboxer_conversation_opt_outs"."conversation_id" = $1 AND "mailboxer_conversation_opt_outs"."unsubscriber_type" = $2 AND "mailboxer_conversation_opt_outs"."unsubscriber_id" = $3  [["conversation_id", 10], ["unsubscriber_type", "User"], ["unsubscriber_id", 2]]
Completed 500 Internal Server Error in 23ms (ActiveRecord: 3.8ms)

ArgumentError (wrong number of arguments (1 for 0)):
app/controllers/messages_controller.rb:9:in `create'

Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (4.5ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.0ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.2ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (23.1ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.3ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.2ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.2ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.2ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts/javascript (12.8ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/javascript (0.4ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.4ms)
Rendered /usr/local/rvm/gems/ruby-2.2.3/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (27.3ms)
  1. I am getting the “Resource Not Found” message when I try to empty the trash.

    Started DELETE “/conversations/empty_trash” for 10.0.2.2 at 2015-10-10 16:21:49 +0000
    Processing by ConversationsController#empty_trash as HTML
    Parameters: {“authenticity_token”=>“mhCTp4FfbBlr573VGWT8PKM16Lu5pAKo93nHVfNMF075wWvnIUMkpO+ipat7rsP3dLNWf7WyYmXxphcQK6C+0w==”}
    User Load (0.3ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 ORDER BY “users”.“id” ASC LIMIT 1 [[“id”, 2]]
    Redirected to http://localhost:3000/conversations?box=trash
    Completed 302 Found in 4ms (ActiveRecord: 0.3ms)

    Started GET “/conversations?box=trash” for 10.0.2.2 at 2015-10-10 16:21:49 +0000
    Processing by ConversationsController#index as HTML
    Parameters: {“box”=>“trash”}
    User Load (0.3ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 ORDER BY “users”.“id” ASC LIMIT 1 [[“id”, 2]]
    (0.4ms) SELECT DISTINCT COUNT(DISTINCT “mailboxer_conversations”.“id”) FROM “mailboxer_conversations” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“conversation_id” = “mailboxer_conversations”.“id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) INNER JOIN “mailboxer_receipts” ON “mailboxer_receipts”.“notification_id” = “mailboxer_notifications”.“id” WHERE “mailboxer_notifications”.“type” = ‘Mailboxer::Message’ AND “mailboxer_receipts”.“mailbox_type” = $1 AND “mailboxer_receipts”.“trashed” = $2 AND “mailboxer_receipts”.“deleted” = $3 AND “mailboxer_notifications”.“type” = ‘Mailboxer::Message’ AND “mailboxer_receipts”.“receiver_id” = $4 AND “mailboxer_receipts”.“receiver_type” = $5 AND “mailboxer_receipts”.“is_read” = $6 [[“mailbox_type”, “inbox”], [“trashed”, “f”], [“deleted”, “f”], [“receiver_id”, 2], [“receiver_type”, “User”], [“is_read”, “f”]]
    (0.8ms) SELECT DISTINCT COUNT(DISTINCT “mailboxer_conversations”.“id”) FROM “mailboxer_conversations” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“conversation_id” = “mailboxer_conversations”.“id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) INNER JOIN “mailboxer_receipts” ON “mailboxer_receipts”.“notification_id” = “mailboxer_notifications”.“id” WHERE “mailboxer_notifications”.“type” = ‘Mailboxer::Message’ AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Conversation Load (0.7ms) SELECT DISTINCT “mailboxer_conversations”.* FROM “mailboxer_conversations” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“conversation_id” = “mailboxer_conversations”.“id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) INNER JOIN “mailboxer_receipts” ON “mailboxer_receipts”.“notification_id” = “mailboxer_notifications”.“id” WHERE “mailboxer_notifications”.“type” = ‘Mailboxer::Message’ AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 ORDER BY mailboxer_conversations.updated_at DESC LIMIT 10 OFFSET 0 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    (0.7ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 9 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.4ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 9]]
    Mailboxer::Receipt Load (0.2ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 11]]
    User Load (0.2ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    User Load (0.2ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    Rendered conversations/_participants.html.erb (6.2ms)
    Mailboxer::Message Load (0.2ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 9]]
    (0.5ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 8 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 8]]
    Mailboxer::Receipt Load (0.1ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 10]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    Rendered conversations/_participants.html.erb (5.6ms)
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 8]]
    (0.3ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 7 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.2ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 7]]
    Mailboxer::Receipt Load (0.1ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 9]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    Rendered conversations/_participants.html.erb (5.2ms)
    Mailboxer::Message Load (0.4ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 7]]
    (0.5ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 6 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 6]]
    Mailboxer::Receipt Load (0.2ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 8]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    Rendered conversations/_participants.html.erb (6.1ms)
    Mailboxer::Message Load (0.5ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 6]]
    (0.4ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 4 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 4]]
    Mailboxer::Receipt Load (0.2ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 4]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    Rendered conversations/_participants.html.erb (5.2ms)
    Mailboxer::Message Load (0.2ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 4]]
    (0.5ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 2 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 2]]
    Mailboxer::Receipt Load (0.2ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 2]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    Rendered conversations/_participants.html.erb (6.2ms)
    Mailboxer::Message Load (0.6ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 2]]
    (0.7ms) SELECT COUNT() FROM “mailboxer_receipts” INNER JOIN “mailboxer_notifications” ON “mailboxer_notifications”.“id” = “mailboxer_receipts”.“notification_id” AND “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) WHERE “mailboxer_notifications”.“conversation_id” = 1 AND “mailboxer_receipts”.“receiver_id” = $1 AND “mailboxer_receipts”.“receiver_type” = $2 AND “mailboxer_receipts”.“trashed” = $3 AND “mailboxer_receipts”.“deleted” = $4 [[“receiver_id”, 2], [“receiver_type”, “User”], [“trashed”, “t”], [“deleted”, “f”]]
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.
    FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at LIMIT 1 [[“conversation_id”, 1]]
    Mailboxer::Receipt Load (0.2ms) SELECT “mailboxer_receipts”.* FROM “mailboxer_receipts” WHERE “mailboxer_receipts”.“notification_id” = $1 [[“notification_id”, 1]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 2]]
    CACHE (0.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT 1 [[“id”, 1]]
    Rendered conversations/_participants.html.erb (5.7ms)
    Mailboxer::Message Load (0.3ms) SELECT “mailboxer_notifications”.* FROM “mailboxer_notifications” WHERE “mailboxer_notifications”.“type” IN (‘Mailboxer::Message’) AND “mailboxer_notifications”.“conversation_id” = $1 ORDER BY created_at DESC LIMIT 1 [[“conversation_id”, 1]]
    Rendered conversations/_conversation.html.erb (163.7ms)
    Rendered conversations/index.html.erb within layouts/application (186.6ms)
    Rendered layouts/_nav.html.erb (3.0ms)
    Rendered layouts/_alert.html.erb (0.7ms)
    Completed 200 OK in 637ms (Views: 621.1ms | ActiveRecord: 12.2ms)

If you need any more information, please let me know. I have been staring at this code for days now trying to figure out what’s wrong.

Thanks