Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Yajl backend discovery fails in ActiveSupport::JSON

#4897

Hi,

In "activesupport/lib/active_support/json/backends/yajl.rb", there is an attempt to use Yajl as a json backend if 'yajl-ruby' gem is available.

This attempt fails because the require statement is erroneous:

require 'yajl-ruby' unless defined?(Yajl)

Should be:

require 'yajl' unless defined?(Yajl)

So Yajl isn't used as default decoding backend when gem is available.

Besides, I find a bit confusing that the gem is referenced as 'yajl-ruby' but the require statement is 'yajl'.

This could be fixed easily in rails 2.3.9 (see attached patch).

Thanks.

Reported by Maxime RETY · June 18th, 2010 @ 11:25 AM

State: committed
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. Brian Lopez
    Brian Lopez

    Woah, that's my bad. Not sure how that even happend since I swear I just copied this file from http://github.com/brianmario/yajl-rails/blob/master/lib/yajl_rails....

    June 18th, 2010 @ 11:40 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • Milestone cleared.
    • State changed from new to verified
    • Assigned user set to José Valim

    Confirmed.

    +1 to the patch. Also required on master as the problem exists there.(applies cleanly on master as well)

    Weird, the gem is installed as 'yajl-ruby' and required as 'yajl'.

    June 19th, 2010 @ 02:22 AM

  3. Repository
  4. Repository
    Repository
    • State changed from verified to committed

    June 19th, 2010 @ 04:12 AM

  5. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM