asking questions is now possible! …kinda.

This commit is contained in:
nilsding 2014-11-10 21:56:30 +01:00
parent 9fad73341e
commit ba71902c27
5 changed files with 18 additions and 5 deletions

View File

@ -0,0 +1,16 @@
class Ajax::QuestionController < ApplicationController
def create
params.require :question
params.require :anonymousQuestion
params.require :rcpt
Question.create(content: params[:question],
author_is_anonymous: params[:anonymousQuestion])
@status = :okay
@message = "Question asked successfully."
@success = true
end
end

View File

@ -1,4 +0,0 @@
class AjaxController < ApplicationController
def ask
end
end

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -24,7 +24,7 @@ Rails.application.routes.draw do
match '/settings/profile', to: 'user#update', via: 'patch', as: :update_user_profile
namespace :ajax do
match '/ask', to: 'ajax#ask', via: :post, as: :ask
match '/ask', to: 'question#create', via: :post, as: :ask
end
match '/user/:username', to: 'user#show', via: 'get'