docs/getting-started.md in panko_serializer-0.7.0 vs docs/getting-started.md in panko_serializer-0.7.1
- old
+ new
@@ -29,10 +29,24 @@
has_many :posts, serializer: PostSerializer
end
```
+### Serializing an object
+
+And now serialize a single object
+
+```ruby
+# Using Oj serializer
+PostSerializer.new.serialize_to_json(Post.first)
+
+# or, similar to #serializable_hash
+PostSerializer.new.serialize(Post.first).to_json
+```
+
+### Using the serializers in a controller
+
As you can see, defining serializers is simple and resembles ActiveModelSerializers 0.9,
To utilize the `UserSerializer` inside a Rails controller and serialize some users, all we need to do is:
```ruby
class UsersController < ApplicationController
@@ -42,6 +56,5 @@
end
end
```
And voila, we have endpoint which serialize users using Panko!
-