Retrospring/app/controllers/ajax/question_controller.rb

18 lines
531 B
Ruby
Raw Normal View History

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