Sha256: 7cff575966ef348f6b545301cdc8b137b7bf7306ef09fa371d743f84e47cb0bb

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

h1. json_serialize -- JSON serialization in ActiveRecord

| *Author* | Tim Morgan |
| *Version* | 2.1 (Apr 4, 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.1.0 README.textile