README.md in alba-1.0.1 vs README.md in alba-1.1.0
- old
+ new
@@ -5,11 +5,11 @@
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/okuramasafumi/alba)
![GitHub](https://img.shields.io/github/license/okuramasafumi/alba)
# Alba
-`Alba` is the fastest JSON serializer for Ruby, JRuby an TruffleRuby.
+Alba is the fastest JSON serializer for Ruby, JRuby, and TruffleRuby.
## Discussions
Alba uses [GitHub Discussions](https://github.com/okuramasafumi/alba/discussions) to openly discuss the project.
@@ -68,10 +68,11 @@
* Selectable backend
* Key transformation
* Root key inference
* Error handling
* Resource name inflection based on association name
+* Circular associations control
* No runtime dependencies
## Anti features
* Sorting keys
@@ -448,24 +449,27 @@
[key, error.message]
end
end
```
-### Caching
+### Circular associations control
-Currently, Alba doesn't support caching, primarily due to the behavior of `ActiveRecord::Relation`'s cache. See [the issue](https://github.com/rails/rails/issues/41784).
+You can control circular associations with `within` option. `within` option is a nested Hash such as `{book: {authors: books}}`. In this example, Alba serializes a book's authors' books. This means you can reference `BookResource` from `AuthorResource` and vice versa. This is really powerful when you have a complex data structure and serialize certain parts of it.
-## Comparison
+For more details, please refer to [test code](https://github.com/okuramasafumi/alba/blob/master/test/usecases/circular_association_test.rb)
-Alba is faster than alternatives.
-For a performance benchmark, see https://gist.github.com/okuramasafumi/4e375525bd3a28e4ca812d2a3b3e5829.
+### Caching
+Currently, Alba doesn't support caching, primarily due to the behavior of `ActiveRecord::Relation`'s cache. See [the issue](https://github.com/rails/rails/issues/41784).
+
## Rails
When you use Alba in Rails, you can create an initializer file with the line below for compatibility with Rails JSON encoder.
```ruby
Alba.backend = :active_support
+# or
+Alba.backend = :oj_rails
```
## Why named "Alba"?
The name "Alba" comes from "albatross", a kind of birds. In Japanese, this bird is called "Aho-dori", which means "stupid bird". I find it funny because in fact albatrosses fly really fast. I hope Alba looks stupid but in fact it does its job quick.