- Very explicit where caching is stored
- No `Rails.cache` automagic with possible colliding keys
- Rails 5.2+ cache versioning support
- Implicit namespace support (by cache instance, e.g.
ActiveSupport::Cache::MemoryStore.new(namespace: 'jast_jsonapi')
- All cache instance options are supported
* allow the relationship's serializer key to be a Proc
* fixes
* specifically test the relationship name and the resource type
* support object blocks without a serializer defined
* stop validation gracefully if the relationship is polymorphic
* improve performance by using instance variables instead of accessor methods
* force initialization up front to avoid the iterative calls
* serializer procs should act like polymorphic when determining the id_method_name
* specs for serializer procs
* updated with more details and examples for relationship serializer options
* adjust specs to define the serializers
* avoid extra method calls for performance
* name change
* one less function call for better performance
* do not require lazy loaded relationships to resolve the serializer
* give polymorphic precedence for backwards compatibility
* move serializer inference into ObjectSerializer to allow for overriding
* move method for better diff
* fix race condition in multi-threaded environments
* Add params to set_id block arguments
Pull request #331 added a block to the ObjectSerializer.set_id class
method, which allows passing a block to the set_id method. Currently
this block takes only one argument `record`:
```
set_id do |record|
"#{record.name.downcase}-#{record.id}"
end
```
This PR adds another argument `params` to the block:
```
set id do |record, params|
params[:admin] ? record.id : "#{record.name.downcase}-#{record.id}"
end
```
This customization can be useful in situation where we serve different
clients that may need different IDs. One nice side effect is also that
the `set_id` method has the same method signature as the `attribute`
method.
* Update the README
* The link was already there but I skipped over it on my first read.
This update makes the fact more prominent.
* I was testing to see if we wanted to move from AM Serializers to
fast_jsonapi but our API is not written according to the JSON:API spec
so, after converting one serializer over, I learned that this would not work for me.
* This update might save someone in my position the ~30 mins or so it
takes to bundle and write a serializer in the future. :)