Skip to content

Commit

Permalink
Fixed JSON support when used as Rails plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Krall committed Jan 1, 2009
1 parent 23c1ae5 commit d4facf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/google_ajax.rb
Expand Up @@ -2,7 +2,7 @@
require 'open-uri'
require 'ostruct'
require 'rubygems'
require 'json'
require 'json' unless defined? Rails

require 'google_ajax/feed'
require 'google_ajax/language'
Expand Down
6 changes: 5 additions & 1 deletion lib/google_ajax/parser.rb
@@ -1,7 +1,11 @@
class GoogleAjax
class Parser
def self.parse(api, method, data)
data = JSON.parse(data)
if defined? Rails
data = ActiveSupport::JSON::decode(data)
else
data = JSON.parse(data)
end
Errors.process(data)
parser = Parser::PARSERS[api][method]
parser.process(data['responseData'])
Expand Down

0 comments on commit d4facf4

Please sign in to comment.