mailboxer recipients

Here ruby on rails - Mailboxer: recipient inbox not showing conversations - Stack Overflow someone shows how to send a message to a recipient_id rather than a recipient object My understanding is recipients has to be an object so how can his example work?

Which line of code is sending a message to a recipient_id?

Colin

Under answer:

1 Answer

I make it working finally, here is my code, maybe it can help other:

(i’m on rails 5)

The link on my product page:

<%= link_to "Contactar", new_conversation_path(recipient_id: service.user.id) %>

My new and create action on my conversation controller:

 def new
 @recipients = User.find(params[:recipient_id])

 end

 def create
recipient = User.find_by(id: params[:recipient_id])
 receipt = current_user.send_message(recipient, params[:body],    params[:subject])
 redirect_to conversation_path(receipt.conversation)
 end

> Here > ruby on rails - Mailboxer: recipient inbox not showing conversations - Stack Overflow > someone shows how to send a message to a recipient_id rather than a > recipient object My understanding is recipients has to be an object so how > can his example work?

Which line of code is sending a message to a recipient_id?

Colin

Under answer:

Why can't you just answer the question? Do you mean this line?

receipt = current_user.send_message(recipient, params[:body], params[:subject])

where recipient is a User. If so I don't understand what you are asking. If you don't mean that line then which line do you mean?

Colin

sorry i misread it i was half asleep

can we agree to delete

I actually misphrased my original question, there is something odd I’ll start a new thread

This is a mailing list, you can't delete mails that are already sent.

Colin