multi_json does not recognise any adapter


I’m in the process of upgrading an app from rails 3.0.6 to 3.2.13.

I have a problem with multi_json not recognising any json adapter.

I have tested with the gems json-1.8.0 and oj (2.1.4), without success…

Inpsecting the adapter it is looking for, I get JSONGem, which seems correct, as I have an adapter in /usr/lib/ruby/gems/1.8/gems/multi_json-1.7.7/lib/multi_json/adapters/json_gem.rb

which has the class

class JsonGem < JsonCommon

I’ve tried to manually set the adapter used as described at :

gem ‘json’

JSON gem loaded, which overwrites to_json

ActiveSupport::JSON.backend = “JsonGem”/“JSONGem”/…

but to no avail.

The gems are available, as checked with:

$ bundle show | grep json

  • json (1.8.0)
  • multi_json (1.7.7)

I’ve tried with ruby 1.8.7 and ruby 1.9.2.

Does anyone have suggestions of how to fix this?


For the record: this was due to this line in an initialiser: ActiveSupport::JSON.backend = “JSONGem”

Commenting it solved the problem.