multi_json does not recognise any adapter

22 views
Skip to first unread message

Raphael Bauduin

unread,
Jul 12, 2013, 7:48:22 AM7/12/13
to rubyonra...@googlegroups.com
Hi,

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 http://weblog.rubyonrails.org/2009/4/24/this-week-in-edge-rails/ :

  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?

Thanks


Raphael Bauduin

unread,
Jul 12, 2013, 9:30:19 AM7/12/13
to rubyonra...@googlegroups.com
For the record: this was due to this line in an initialiser:
   ActiveSupport::JSON.backend = "JSONGem"

Commenting it solved the problem.

Raph
--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org
Reply all
Reply to author
Forward
0 new messages