https://github.com/westonganger/lazy_serialize
Lazy Serialize is an alternative to ActiveRecord's serialize method which does not serialize each column until the first call to the attribute.
https://github.com/westonganger/lazy_serialize
activerecord database rails ruby serialization
Last synced: 2 months ago
JSON representation
Lazy Serialize is an alternative to ActiveRecord's serialize method which does not serialize each column until the first call to the attribute.
- Host: GitHub
- URL: https://github.com/westonganger/lazy_serialize
- Owner: westonganger
- License: mit
- Created: 2017-01-24T20:56:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-05T18:28:52.000Z (about 8 years ago)
- Last Synced: 2025-03-13T02:03:33.887Z (over 1 year ago)
- Topics: activerecord, database, rails, ruby, serialization
- Language: Ruby
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Lazy Serialize is an alternative to ActiveRecord's `serialize` method which does not serialize each column until the first call to the attribute.
# Install
Use git source as its not yet published to rubygems
```ruby
# Gemfile
gem 'lazy_serialize', git: 'https://github.com/westonganger/lazy_serialize.git'
```
# Usage
Usage is almost the same as the regular serialize
```ruby
class MyClass
include LazySerialize
lazy_serialize :my_attribute, Hash
end
```
Available Types are Hash, HashWithIndifferentAccess, Array, JSON, YAML
# Credits
Created by Weston Ganger - @westonganger