Last active
November 16, 2017 10:11
-
-
Save domagude/45f1768498363efc6d1292cb6972f77c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def create | |
recipient_id = Post.find(params[:post_id]).user.id | |
conversation = Private::Conversation.new(sender_id: current_user.id, | |
recipient_id: recipient_id) | |
if conversation.save | |
Private::Message.create(user_id: recipient_id, | |
conversation_id: conversation.id, | |
body: params[:message_body]) | |
respond_to do |format| | |
format.js {render partial: 'posts/show/contact_user/message_form/success'} | |
end | |
else | |
respond_to do |format| | |
format.js {render partial: 'posts/show/contact_user/message_form/fail'} | |
end | |
end | |
end | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment