This commit is contained in:
parent
61fdaf6742
commit
05ca42c819
|
@ -1,4 +1,11 @@
|
|||
class Ajax::AnswerController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |titanic_param|
|
||||
@status = :parameter_error
|
||||
@message = "#{titanic_param.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
params.require :id
|
||||
params.require :answer
|
||||
|
@ -27,6 +34,14 @@ class Ajax::AnswerController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# this should never trigger because empty params throw ParameterMissing
|
||||
unless params[:answer].length > 0
|
||||
@status = :peter_dinklage
|
||||
@message = "Answer is too short"
|
||||
@success = false
|
||||
return
|
||||
end
|
||||
|
||||
answer = nil
|
||||
|
||||
begin
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Ajax::CommentController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
params.require :answer
|
||||
params.require :comment
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Ajax::FriendController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
params.require :screen_name
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Ajax::GroupController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
@status = :err
|
||||
@success = false
|
||||
|
@ -101,7 +108,7 @@ class Ajax::GroupController < ApplicationController
|
|||
@checked = false
|
||||
@message = "Successfully removed user from group."
|
||||
end
|
||||
|
||||
|
||||
@status = :okay
|
||||
@success = true
|
||||
end
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Ajax::InboxController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
unless user_signed_in?
|
||||
@status = :noauth
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
class Ajax::ModerationController < ApplicationController
|
||||
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def vote
|
||||
params.require :id
|
||||
params.require :upvote
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
class Ajax::QuestionController < ApplicationController
|
||||
include MarkdownHelper
|
||||
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def destroy
|
||||
params.require :question
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Ajax::ReportController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
params.require :id
|
||||
params.require :type
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Ajax::SmileController < ApplicationController
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def create
|
||||
params.require :id
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
class Ajax::SubscriptionController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
rescue_from(ActionController::ParameterMissing) do |param_miss_ex|
|
||||
@status = :parameter_error
|
||||
@message = "#{param_miss_ex.param.capitalize} is required"
|
||||
@success = false
|
||||
render partial: "ajax/shared/status"
|
||||
end
|
||||
|
||||
def subscribe
|
||||
params.require :answer
|
||||
|
|
Loading…
Reference in New Issue