examples/overriding_serialization.rb in adapter-0.6.1 vs examples/overriding_serialization.rb in adapter-0.6.2
- old
+ new
@@ -17,15 +17,15 @@
# In our case below, we simply override the memory adapter to create
# a new adapter that encodes/decodes using JSON instead of the default
# Marshal.load/dump. Also, important to note that this does not affect
# the memory adapter which still uses Marshal.
Adapter.define(:memory_json, Adapter::Memory) do
- def encode(value)
- ActiveSupport::JSON.encode(value)
+ def encode(attributes)
+ ActiveSupport::JSON.encode(attributes)
end
- def decode(value)
- ActiveSupport::JSON.decode(value)
+ def decode(attributes)
+ ActiveSupport::JSON.decode(attributes)
end
end
adapter = Adapter[:memory_json].new({})
adapter.clear