blob: 97025ae4d3e5b8866b85a611452152d4830699e9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
module ActiveRecord #:nodoc:
module Serialization
def to_json(options = {}, &block)
JsonSerializer.new(self, options).to_s
end
def from_json(json)
self.attributes = ActiveSupport::JSON.decode(json)
self
end
class JsonSerializer < ActiveRecord::Serialization::Serializer #:nodoc:
def serialize
serializable_record.to_json
end
end
end
end
|