mailboxer recipients

36 views
Skip to first unread message

fugee ohu

unread,
Sep 25, 2017, 6:13:29 AM9/25/17
to Ruby on Rails: Talk
Here https://stackoverflow.com/questions/44417543/mailboxer-recipient-inbox-not-showing-conversations 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?

Colin Law

unread,
Sep 25, 2017, 6:28:17 AM9/25/17
to Ruby on Rails: Talk
Which line of code is sending a message to a recipient_id?

Colin

fugee ohu

unread,
Sep 25, 2017, 10:21:33 AM9/25/17
to Ruby on Rails: Talk
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
 

Colin Law

unread,
Sep 25, 2017, 10:32:18 AM9/25/17
to Ruby on Rails: Talk
On 25 September 2017 at 15:21, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Monday, September 25, 2017 at 6:28:17 AM UTC-4, Colin Law wrote:
>>
>> On 25 September 2017 at 11:13, fugee ohu <fuge...@gmail.com> wrote:
>> > Here
>> > https://stackoverflow.com/questions/44417543/mailboxer-recipient-inbox-not-showing-conversations
>> > 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

fugee ohu

unread,
Sep 25, 2017, 10:47:10 AM9/25/17
to Ruby on Rails: Talk
sorry i misread it i was half asleep

fugee ohu

unread,
Sep 25, 2017, 10:49:52 AM9/25/17
to Ruby on Rails: Talk


On Monday, September 25, 2017 at 10:32:18 AM UTC-4, Colin Law wrote:
On 25 September 2017 at 15:21, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Monday, September 25, 2017 at 6:28:17 AM UTC-4, Colin Law wrote:
>>
>> On 25 September 2017 at 11:13, fugee ohu <fuge...@gmail.com> wrote:
>> > Here
>> > https://stackoverflow.com/questions/44417543/mailboxer-recipient-inbox-not-showing-conversations
>> > 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:
e

>  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

can we agree to delete

fugee ohu

unread,
Sep 25, 2017, 10:51:23 AM9/25/17
to Ruby on Rails: Talk
I actually misphrased my original question, there is something odd I'll start a new thread

Colin Law

unread,
Sep 25, 2017, 11:59:34 AM9/25/17
to Ruby on Rails: Talk
On 25 September 2017 at 15:49, fugee ohu <fuge...@gmail.com> wrote:
> can we agree to delete

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

Colin
Reply all
Reply to author
Forward
0 new messages