New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation Between User and current user #485
Comments
SunnyAforka
changed the title
Conversation Between User and and current user
Conversation Between User and current user
Jul 2, 2018
Is it not just a matter of setting the recipient to that user? You can pass the ID of that user to your conversations controller with a hidden field, for example. In your conversations controller:
Somewhere in your users/show.html.erb view:
|
Thanks bro for your help... would implement that asap. I actually left the
project i was working on but with your response, it time to go back to the
project.
…On Sat, Jul 28, 2018 at 8:38 PM Dominic Nunes ***@***.***> wrote:
Is it not just a matter of setting the recipient to that user? You can
pass the ID of that user to your conversations controller with a hidden
field, for example.
In your conversations controller:
def create
recipient = User.find(params[:recipient_id])
current_user.send_message(recipient, params[:body], params[:subject])
redirect_to conversations_path
end
Somewhere in your users/show.html.erb view:
<%= form_tag conversations_path, method: :post do %>
<%= hidden_field :recipient_id, @user.id %> # pass the user id as
recipient_id param
<p><%= text_field_tag :subject, nil, placeholder: "Subject" %></p>
<p><%= text_area_tag :body, nil, placeholder: "Say hi..." %></p>
<%= submit_tag %>
<% end %>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#485 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXFzmDpwjXoWnIw96sAH9icA_SQYenXyks5uLL2YgaJpZM4U_A_3>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am thinking of how to auto fill recipient with @user of a current page so the the current user does not have to search or select user to send a message to.
For example i have created a page for each user like a profile page, Then a current user visits another user's page would just see a mail-boxer form to type message without typing or searching recipient, just hits send and it goes straight to the @user mail-boxer inbox so then a conversation between the @user and current_user is established.
I don't know if i am understood!
The text was updated successfully, but these errors were encountered: