Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:45:39+00:00 2026-06-15T08:45:39+00:00

Im using the mailboxer gem to build a private messaging system. I want to

  • 0

Im using the mailboxer gem to build a private messaging system.

I want to loop over my user list, and next to each users name, provide a link to open a preexisting conversation if it exists, or create a new one if no conversation does exist. (So users would only be able to have 1 conversation with another user, rather than an email like system).

<% @users.each do |u| %>
  <%= link_to u.name, u %>
  <% @mailbox.conversations.each do |c| %>
    <% if c.receipts.where(:receiver_id => user).present? %>
     true
    <% else %>
     false
    <% end %>
  <% end %>
<% end %>

so “true” would be the link to reopen the conversation and “false” would be a button for a new conversation.

but if a user has 4 conversations and 1 with a given user, it would return true false false false. so 1 continue button and 3 create new. so essentially, i need the entire thing to return either true or false

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:45:41+00:00Added an answer on June 15, 2026 at 8:45 am

    if anyone is interested, this is a more elegant solution. just in the controller. then all links are the same, and it will open message if it exists. filtering by Conversation.participant(a).participant(b) was the key

    def new
      @recipient = User.find(params[:recipient])
      @ongoing_conversation = Conversation.participant(current_user).participant(@recipient)
    
      respond_to do |format|
        format.html { redirect_to root_path }
        if @ongoing_conversation.present?
          format.js { redirect_to mailbox.conversations.find(@ongoing_conversation) }
        else
          format.js
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using gem called Mailboxer on rails3. Everytime, mailboxer delivers email, and it
I'm using mailboxer gem and I don't know how to use it with Paperclip
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
Using a populated Table Type as the source for a TSQL-Merge. I want to
I'm trying to get a list of mailboxes using AE.Net.Mail and I cannot find
EDIT : Problem with the email I get mailbox unavailable exception! DBEmail.cs using System;
I'm using Exchange web services, trying to create a calendar entry in another user's
I'd like to open single-file unix mailbox using some free java library. I want
I was trying to install this gem https://github.com/frodefi/rails-messaging into a rails application. The README
I'm using pyramid to build up a web site and would like to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.