Support Ruby 2.4.

This commit is contained in:
Guo Xiang Tan
2017-04-15 12:11:02 +08:00
parent 86efc57390
commit 04016f0dec
29 changed files with 73 additions and 60 deletions

View File

@@ -465,7 +465,7 @@ class ApplicationController < ActionController::Base
# type - a machine-readable description of the error
# status - HTTP status code to return
def render_json_error(obj, opts={})
opts = { status: opts } if opts.is_a?(Fixnum)
opts = { status: opts } if opts.is_a?(Integer)
render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422
end

View File

@@ -744,7 +744,7 @@ class UsersController < ApplicationController
result = {}
%W{number_of_deleted_posts number_of_flagged_posts number_of_flags_given number_of_suspensions number_of_warnings}.each do |info|
%W{number_of_deleted_posts number_of_flagged_posts number_of_flags_given number_of_suspensions warnings_received_count}.each do |info|
result[info] = @user.send(info)
end