Skip to content

Commit

Permalink
Merge pull request #8846 from AlexRiedler/revert_5861
Browse files Browse the repository at this point in the history
Backport multi_json dependency revert of #5861 to 3-1-stable
  • Loading branch information
rafaelfranca committed Jan 9, 2013
2 parents a97199d + 7b9bab6 commit b816e8e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 6 additions & 0 deletions activesupport/CHANGELOG.md
@@ -1,3 +1,9 @@
## Rails 3.1.11 ##

* Allow multi_json version >= 1.3, relaxing
back to semantic versioning 2.0.0 (revert of #5861)
Backport of #5896

## Rails 3.1.10 (Jan 8, 2012) ##

* Hash.from_xml raises when it encounters type="symbol" or type="yaml".
Expand Down
2 changes: 1 addition & 1 deletion activesupport/activesupport.gemspec
Expand Up @@ -18,5 +18,5 @@ Gem::Specification.new do |s|

s.rdoc_options.concat ['--encoding', 'UTF-8']

s.add_dependency('multi_json', '>= 1.0', '< 1.3')
s.add_dependency('multi_json', '~> 1.0')
end
20 changes: 17 additions & 3 deletions activesupport/lib/active_support/json/decoding.rb
Expand Up @@ -9,7 +9,13 @@ module ActiveSupport
module JSON
class << self
def decode(json, options ={})
data = MultiJson.decode(json, options)
# Can't reliably detect whether MultiJson responds to load, since it's
# a reserved word. Use adapter as a proxy for new features.
data = if MultiJson.respond_to?(:adapter)
MultiJson.load(json, options)
else
MultiJson.decode(json, options)
end
if ActiveSupport.parse_json_times
convert_dates_from(data)
else
Expand All @@ -18,12 +24,20 @@ def decode(json, options ={})
end

def engine
MultiJson.engine
if MultiJson.respond_to?(:adapter)
MultiJson.adapter
else
MultiJson.engine
end
end
alias :backend :engine

def engine=(name)
MultiJson.engine = name
if MultiJson.respond_to?(:use)
MultiJson.use name
else
MultiJson.engine = name
end
end
alias :backend= :engine=

Expand Down

0 comments on commit b816e8e

Please sign in to comment.