2014-11-10 12:56:30 -08:00
|
|
|
class Ajax::QuestionController < ApplicationController
|
|
|
|
def create
|
|
|
|
params.require :question
|
|
|
|
params.require :anonymousQuestion
|
|
|
|
params.require :rcpt
|
|
|
|
|
2014-11-10 14:46:38 -08:00
|
|
|
question = Question.create!(content: params[:question],
|
2014-11-10 21:51:56 -08:00
|
|
|
author_is_anonymous: params[:anonymousQuestion],
|
2014-11-10 22:08:59 -08:00
|
|
|
user: current_user)
|
2014-11-10 12:56:30 -08:00
|
|
|
|
2014-11-10 14:46:38 -08:00
|
|
|
Inbox.create!(user_id: params[:rcpt], question_id: question.id, new: true)
|
2014-11-10 12:56:30 -08:00
|
|
|
|
|
|
|
@status = :okay
|
|
|
|
@message = "Question asked successfully."
|
|
|
|
@success = true
|
|
|
|
end
|
|
|
|
end
|