Skip to content

Instantly share code, notes, and snippets.

@kiote
Created August 6, 2014 07:41
Show Gist options
  • Save kiote/4415d620836de5ad62f4 to your computer and use it in GitHub Desktop.
Save kiote/4415d620836de5ad62f4 to your computer and use it in GitHub Desktop.
def create
@question = Question.new(params[:question])
// @conversation = Conversation.create
if @question.save
@message = current_user.send_message(@question, @question.question, "You have a question from #{@question.sender_id}")
//messages.new(:subject => "You have a question from #{@question.sender_id}",
// :notification_id => @question.sender_id,
// :receiver_id => @question.recipient_id,
// :conversation_id => @conversation.id,
// :body => @question.question)
@question.message = @message
@question.save
redirect_to :back, notice: 'Your question was saved successfully. Thanks!'
else
render :new, alert: 'Sorry. There was a problem saving your question.'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment