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
No comments:
Post a Comment