Switch to MultiJson which uses Oj under the hood (since it is available).
authorWard Vandewege <ward@clinicalfuture.com>
Mon, 4 Feb 2013 16:25:30 +0000 (11:25 -0500)
committerWard Vandewege <ward@clinicalfuture.com>
Mon, 4 Feb 2013 16:25:30 +0000 (11:25 -0500)
Gemfile
Gemfile.lock
app/controllers/application_controller.rb
app/controllers/orvos/v1/links_controller.rb

diff --git a/Gemfile b/Gemfile
index c60bf9f7701210724c2df1063ddeddd55ebbd498..8c93a4dbfc135e24d62e133e756119b4a87b9256 100644 (file)
--- 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
index e78e65692e14c14421dd75c00e4b3daa2a6d32aa..8a80c7765a954943ab6d846045b246fd8978c889 100644 (file)
@@ -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)
index d3427160cbbfd249476264441f4ec58f4a1199ee..a1b167035edb95f0ea69e64bd88c7427a4803eba 100644 (file)
@@ -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
index 046f6838f27851df2add5dd975016c1c42a4fa1c..5d34d50d50603afdac02fa988ec46f54e9d3b37b 100644 (file)
@@ -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