From 92a074bc18a838aeb0ada8555fbf749f7b150c82 Mon Sep 17 00:00:00 2001 From: sanemat Date: Thu, 11 Oct 2012 02:51:34 +0900 Subject: [PATCH 1/3] Compatible multi_json >= 1.0.0 with Rails3.2.8 --- lib/compat/multi_json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/multi_json.rb b/lib/compat/multi_json.rb index 7d3953ae9..533938567 100644 --- a/lib/compat/multi_json.rb +++ b/lib/compat/multi_json.rb @@ -1,7 +1,7 @@ gem 'multi_json', '>= 1.0.0' require 'multi_json' -if !MultiJson.respond_to?(:load) || MultiJson.method(:load).owner == Kernel +if !MultiJson.respond_to?(:load) || [Kernel, ActiveSupport::Dependencies::Loadable].include?(MultiJson.method(:load).owner) module MultiJson class < Date: Thu, 11 Oct 2012 09:23:53 +0900 Subject: [PATCH 2/3] Add namespace check --- lib/compat/multi_json.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/compat/multi_json.rb b/lib/compat/multi_json.rb index 533938567..e62de7640 100644 --- a/lib/compat/multi_json.rb +++ b/lib/compat/multi_json.rb @@ -1,7 +1,10 @@ gem 'multi_json', '>= 1.0.0' require 'multi_json' -if !MultiJson.respond_to?(:load) || [Kernel, ActiveSupport::Dependencies::Loadable].include?(MultiJson.method(:load).owner) +if !MultiJson.respond_to?(:load) || [ + defined?(Kernel) && Kernel, + defined?(ActiveSupport::Dependencies::Loadable) && ActiveSupport::Dependencies::Loadable +].compact.include?(MultiJson.method(:load).owner) module MultiJson class < Date: Sat, 13 Oct 2012 15:43:52 +0900 Subject: [PATCH 3/3] Remove too much checking --- lib/compat/multi_json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/multi_json.rb b/lib/compat/multi_json.rb index e62de7640..03ccf6dc9 100644 --- a/lib/compat/multi_json.rb +++ b/lib/compat/multi_json.rb @@ -2,7 +2,7 @@ gem 'multi_json', '>= 1.0.0' require 'multi_json' if !MultiJson.respond_to?(:load) || [ - defined?(Kernel) && Kernel, + Kernel, defined?(ActiveSupport::Dependencies::Loadable) && ActiveSupport::Dependencies::Loadable ].compact.include?(MultiJson.method(:load).owner) module MultiJson