lp-serializable 0.2.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -1
- data/lib/lp/serializable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571bdc82cdc4daa0a04c7bc64ffc0eb6aa147e01a864f080d3defa30d2894077
|
4
|
+
data.tar.gz: 6fb5aa279f61c83de4df3c31c72aa7f40fb570299dc66ee93a9a15c1fdd8dd0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18adea0133108a9ab4f8de8184da80176f9823cc97cb6a95af79ff081f3dd489f452d27caed37ae4f7e04932dba5014a5bc601bee63c5f13f717603274331286
|
7
|
+
data.tar.gz: 7db2565d566e1b232a58be585e15726a7e2f0b1d699515c0941d5acd712e43fff9ff989a4cc613ae7caf1c3b2335a5224850ce9e0a439456fac90d991b586601
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -92,7 +92,7 @@ movie
|
|
92
92
|
|
93
93
|
**Return a hash**
|
94
94
|
```ruby
|
95
|
-
hash =
|
95
|
+
hash = serializable(movie)
|
96
96
|
```
|
97
97
|
|
98
98
|
**Output**
|
@@ -157,6 +157,18 @@ end
|
|
157
157
|
|
158
158
|
Attribute `:actors` will trigger `ActorSerializer` to serialize the actors collection. Consequently, any relationships defined in `ActorSerializer` via custom attributes and serialized with `serializable_` methods (using the `nested: true` option) will be appropriately nested.
|
159
159
|
|
160
|
+
## Custom Serializer Class
|
161
|
+
|
162
|
+
Use `#serializable_class` to serialize with a custom class:
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
def show
|
166
|
+
movie = Movie.find(params[:id])
|
167
|
+
# Will serialize with FilmSerializer instead of MovieSerializer
|
168
|
+
movie_hash = serializable_class(movie, 'Film')
|
169
|
+
render json: movie_hash
|
170
|
+
end
|
171
|
+
```
|
160
172
|
|
161
173
|
## Options Support
|
162
174
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lp-serializable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrjonesbot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|