From: Ward Vandewege Date: Mon, 4 Feb 2013 16:25:30 +0000 (-0500) Subject: Switch to MultiJson which uses Oj under the hood (since it is available). X-Git-Tag: 1.1.0~3447 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/7a01e44e4a48e2dd9d677ed9cf61f059b0d4c718?ds=sidebyside;hp=30ede5f10b09a363bf71d722c08d39ca2bc4c30f Switch to MultiJson which uses Oj under the hood (since it is available). --- diff --git a/Gemfile b/Gemfile index c60bf9f770..8c93a4dbfc 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ gem 'rails', '3.1.10' #gem 'sqlite3' gem 'pg' +gem 'multi_json' gem 'oj' # Gems used only for assets and not required diff --git a/Gemfile.lock b/Gemfile.lock index e78e65692e..8a80c7765a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -161,6 +161,7 @@ DEPENDENCIES acts_as_api coffee-rails (~> 3.1.1) jquery-rails + multi_json oj omniauth (= 1.1.1) omniauth-oauth2 (= 1.1.1) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d3427160cb..a1b167035e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -56,7 +56,7 @@ class ApplicationController < ActionController::Base current_user.uuid, current_user.uuid) if params[:where] where = params[:where] - where = Oj.load(where) if where.is_a?(String) + where = MultiJson.load(where) if where.is_a?(String) conditions = ['1=1'] where.each do |attr,value| if (!value.nil? and @@ -98,7 +98,7 @@ class ApplicationController < ActionController::Base raise "no #{resource_name} (or #{resource_name.camelcase(:lower)}) provided with request #{params.inspect}" end if @attrs.class == String - @attrs = uncamelcase_hash_keys(Oj.load @attrs) + @attrs = uncamelcase_hash_keys(MultiJson.load @attrs) end @object = model_class.new @attrs @object.save @@ -108,7 +108,7 @@ class ApplicationController < ActionController::Base def update @attrs = params[resource_name] if @attrs.is_a? String - @attrs = uncamelcase_hash_keys(Oj.load @attrs) + @attrs = uncamelcase_hash_keys(MultiJson.load @attrs) end @object.update_attributes @attrs show @@ -191,7 +191,7 @@ class ApplicationController < ActionController::Base def accept_attribute_as_json(attr, force_class) if params[resource_name].is_a? Hash if params[resource_name][attr].is_a? String - params[resource_name][attr] = Oj.load params[resource_name][attr] + params[resource_name][attr] = MultiJson.load params[resource_name][attr] if force_class and !params[resource_name][attr].is_a? force_class raise TypeError.new("#{resource_name}[#{attr.to_s}] must be a #{force_class.to_s}") end diff --git a/app/controllers/orvos/v1/links_controller.rb b/app/controllers/orvos/v1/links_controller.rb index 046f6838f2..5d34d50d50 100644 --- a/app/controllers/orvos/v1/links_controller.rb +++ b/app/controllers/orvos/v1/links_controller.rb @@ -1,7 +1,7 @@ class Orvos::V1::LinksController < ApplicationController def index if params[:tail_uuid] - params[:where] = Oj.load(params[:where]) if params[:where].is_a?(String) + params[:where] = MultiJson.load(params[:where]) if params[:where].is_a?(String) params[:where] ||= {} params[:where][:tail_uuid] = params[:tail_uuid] end