Ruby-on-Rails: How can I open a converstion with a user on the user's profile page

My question is based on this Ruby on Rails tutorial by Domantas G https://medium.freecodecamp.org/lets-create-an-intermediate-level-ruby-on-rails-application-d7c6e997c63f

Things are working well on my app except that I created profiles page for users and trying to open a conversation from their profile page with this line of code

<span>
   <%= link_to open_private_conversation_path(conversation_id: conversation.id), remote: true, method: :post, class: 'bigger-screen-link btn btn-success btn-sm' do %>
    <i class="fa fa-envelope-o"></i> Chat User
   <% end %>
   <%= link_to open_messenger_path(id: recipient.id, smaller_device: true, type: 'private'), class: 'smaller-screen-link btn btn-success btn-sm' do %>
        <i class="fa fa-envelope-o"></i> Chat User
   <% end %>
</span>

but I get the error

undefined local variable or method `conversation' for #<#<Class:0x0000000011ccdfd8>:0x000000001eacfd00>

I’m pretty sure I have to define what is conversation id in the show action of my controller but I don’t know how to do that.