Permalink
Browse files

Switch to MultiJson.

  • Loading branch information...
Kyle Kingsbury
Kyle Kingsbury committed Jul 12, 2011
1 parent c8d5fad commit bb159c2932b30e699a3abe9d1b627f82e4120795
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/risky.rb
View
@@ -3,15 +3,15 @@ class Risky
require 'riak'
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
-
+
# Exceptions
require 'risky/invalid'
require 'risky/not_found'
# Fix threading autoload bugs
require 'risky/threadsafe'
- # Plugins
+ # Default plugins
require 'risky/cron_list'
require 'risky/indexes'
require 'risky/timestamps'
@@ -416,7 +416,7 @@ def load_riak_object(riak_object, opts = {:merge => true})
self.merged = true
else
# Not merging
- self.values = self.class.cast(JSON.parse(riak_object.raw_data)) rescue {}
+ self.values = self.class.cast(MultiJson.decode(riak_object.raw_data)) rescue {}
self.class.values.each do |k, v|
values[k] ||= (v[:default].clone rescue v[:default])
end
@@ -491,7 +491,7 @@ def save(opts = {})
return false unless valid?
end
- @riak_object.raw_data = @values.to_json
+ @riak_object.raw_data = MultiJson.encode @values
@riak_object.content_type = "application/json"
store_opts = {}

0 comments on commit bb159c2

Please sign in to comment.