Skip to content

Compatible multi_json >= 1.0.0 with Rails3.2.8 #13

Merged
merged 3 commits into from Dec 30, 2012

4 participants

@sanemat
sanemat commented Oct 10, 2012

Compatible multi_json >= 1.0.0 with Rails3.2.8

In specific, using active_support(also rails), MultiJson.method(:load).owner is ActiveSupport::Dependencies::Loadable

In this module, owner is ActiveSupport::Dependencies::Loadable, but some_module if you include, this has #load method, then This does not work, I think. It's fragile.

@sporkmonger

This will probably cause NameError exceptions if ActiveSupport isn't loaded.

@sanemat
sanemat commented Oct 12, 2012

yes, so I pushed commit for checking namespace f9ccc6e

@sporkmonger

Normally I'm OK with defensive coding, but checking for the existence of Kernel is over the top. It's guaranteed to be defined.

@sanemat
sanemat commented Oct 14, 2012

Remove too much checking. 6e40390

@sporkmonger

Looks good. Have you signed the Google CLA?

@sanemat
sanemat commented Oct 15, 2012

I signed yesterday :smile:

@sqrrrl sqrrrl merged commit 8c2b734 into google:master Dec 30, 2012

1 check passed

Details default The Travis build passed
@kozak
kozak commented Mar 3, 2013

This still breaks if there is another module that overrides the load method. For example https://github.com/thedarkone/rails-dev-boost.

Not sure if this will fix it but maybe it would be enough to check if

MultiJson.method(:load).owner == MultiJson 

instead of the specific checks done here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.