Merge pull request #23 from Retrospring/issue-49

Issue-49
This commit is contained in:
Georg G. 2015-05-09 15:09:35 +02:00
commit c3c9f76f37
10 changed files with 78 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,10 @@
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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