mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-19 07:36:03 +01:00
the user who asked is now stored in the question
This commit is contained in:
parent
62eae3affe
commit
fa96e84239
1 changed files with 8 additions and 1 deletions
|
@ -4,8 +4,15 @@ class Ajax::QuestionController < ApplicationController
|
||||||
params.require :anonymousQuestion
|
params.require :anonymousQuestion
|
||||||
params.require :rcpt
|
params.require :rcpt
|
||||||
|
|
||||||
|
user = unless user_signed_in?
|
||||||
|
current_user
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
question = Question.create!(content: params[:question],
|
question = Question.create!(content: params[:question],
|
||||||
author_is_anonymous: params[:anonymousQuestion])
|
author_is_anonymous: params[:anonymousQuestion],
|
||||||
|
user: user)
|
||||||
|
|
||||||
Inbox.create!(user_id: params[:rcpt], question_id: question.id, new: true)
|
Inbox.create!(user_id: params[:rcpt], question_id: question.id, new: true)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue