Created
July 14, 2017 21:58
-
-
Save bjoerne2/af89616806d522c9d08cc8a76bf43c3d 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 | |
@conversation_transient_model = ConversationTransientModel.new(conversation_params) | |
if @conversation_transient_model.valid? | |
recipients = User.where(id: @conversation_transient_model.recipients) | |
conversation = current_user.send_message(recipients, @conversation_transient_model.body, @conversation_transient_model.subject).conversation | |
flash[:notice] = "Your message was successfully sent!" | |
redirect_to conversation_path(conversation) | |
else | |
flash[:error] = "Errors found!" | |
render action: 'new' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment