Sha256: aaf972f6b43a8afd0a5c3c5656072cf3a4e34f7cca1493188144845d54671b6c
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 Bytes
Contents
h1. json_serialize -- JSON serialization in ActiveRecord | *Author* | Tim Morgan | | *Version* | 2.2 (Sep 15, 2011) | | *License* | Released under the MIT license. | h2. About @json_serialize@ gives you the ability to JSON-encode data into ActiveRecord model fields. JSON is a more compact but less robust serialization than YAML. Only hashes, arrays, and primitives can be reliably encoded to database fields; other types may not decode properly or at all. h2. Installation and Usage Firstly, add the gem to your Rails project's @Gemfile@: <pre><code> gem 'json_serialize' </code></pre> Then, include into your model the @JsonSerialize@ module, and call the @json_serialize@ method to indicate which fields should be serialized: <pre><code> class MyModel < ActiveRecord::Base include JsonSerialize json_serialize :favorites, :preferences end </code></pre> More information can be found at the {JsonSerialize#json_serialize} method documentation.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json_serialize-2.2.0 | README.textile |