João Moura
6251b90d25
Merge pull request #902 from cristianbica/serializer_file_digest
...
Added serializer file digest to the cache_key
2015-06-12 18:56:43 -03:00
Santiago Pastorino
4752e6723a
Make resource generator invoke serializer generator
2015-06-10 20:45:33 -03:00
Chris Branson
d34bba07b9
Ensure the adapters honor a custom root option and include meta when required
2015-06-04 17:33:41 +01:00
João Moura
a40df8fd3d
reverting PR #909 and adding json api usage advise on readme
2015-05-27 18:35:00 -03:00
João Moura
12adb2e6d4
Merge pull request #924 from navinpeiris/fragment-cache
...
Avoid unecessary calls to attribute methods when fragment caching
2015-05-27 14:55:31 -03:00
Navin Peiris
e0947fcbd4
Fixing issue where fragment cache calls attribute methods multiple times, even when they are supposed to be cached
2015-05-22 00:40:22 +05:30
Benedikt Deicke
4f576a1463
Adjusts JsonApi adapter to serialize relationships in a nested relationships hash
2015-05-21 16:35:35 +02:00
Benedikt Deicke
ca41901fb8
Adjusts JsonApi adapter to serialize attributes in a nested attributes hash
2015-05-21 16:23:01 +02:00
Guillermo Iguaran
f7fb4dbb98
Merge pull request #909 from joaomdmoura/json-api-default
...
Defining Json-API Adapter as Default
2015-05-20 20:50:19 -05:00
groyoh
5393e5d235
Prevent possible duplicated attributes
...
Calling ActiveModel::Serializer.attributes or ActiveModel::Serializer.attribute
methods multiple times won't create duplicated attributes anymore.
2015-05-18 22:42:10 +02:00
João Moura
d981ee5106
Merge pull request #880 from groyoh/serializer-inheritance
...
Inabling subclasses serializers to inherit attributes
2015-05-18 11:34:10 -03:00
groyoh
a794a06fa5
Fixed #911
2015-05-17 22:47:44 +02:00
João Moura
2c9c36e21f
adding json_api as default adapter
2015-05-10 03:58:18 -03:00
João Moura
46ae776175
Merge pull request #897 from imanel/patch-1
...
Allow to define custom serializer for given class
2015-05-10 03:28:14 -03:00
Cristian Bica
7a62d31777
Added serializer file digest to the cache_key
...
Fixes #901
2015-05-06 08:37:18 +03:00
Bernard Potocki
c91b649504
Allow to define custom serializer for given class by defining #serializer_class method in serialized object's class. Resolves #515 .
2015-05-03 17:47:52 +02:00
groyoh
5dcdfaaef3
Fixed a bug that appeared when json adapter serialize a nil association
2015-04-28 22:20:21 +02:00
Yohan Robert
02ffff599f
Serializers now inherit attributes
2015-04-23 13:25:36 +02:00
Alexandre de Oliveira
1577969cb7
Bumps to 0.10.0.rc1
2015-04-22 03:06:06 -03:00
Alexandre de Oliveira
168c36fc7d
Merge pull request #810 from joaomdmoura/fragment-cache
...
Adding Fragment Cache to AMS
2015-04-21 17:57:55 -03:00
João Moura
792fb8a905
Adding Fragment Cache to AMS
...
It's an upgrade based on the new Cache implementation #693 .
It allows to use the Rails conventions to cache
specific attributes or associations.
It's based on the Cache Composition implementation.
2015-04-05 18:19:57 -03:00
Yohan Robert
6a0564a241
Fixed a bug that appears when a nil association is included
2015-04-03 12:50:05 +02:00
Mateo Murphy
9aebc6cb11
Fix bugs with included resources
...
Make sure they're cached along with the including resource and remove duplicates
2015-03-24 20:07:25 -04:00
Mateo Murphy
90c7005c79
Don't store the root as we don't need it elsewhere
2015-03-23 12:38:15 -04:00
Mateo Murphy
294d06624f
Remove unused embed option
2015-03-22 20:43:56 -04:00
Mateo Murphy
33f3a88ba0
Implement included and id and type as per spec
2015-03-22 20:43:56 -04:00
Mateo Murphy
d82c599c68
Always use plural for linked types
...
Although spec is agnostic about inflection rules, examples given are plural
2015-03-22 20:43:11 -04:00
Mateo Murphy
0f55f21266
Update format of links
2015-03-22 20:41:20 -04:00
Mateo Murphy
83c2854094
Rename add_linked to add_included
...
Better reflect generated output
2015-03-22 20:38:30 -04:00
Mateo Murphy
da86747a3e
Use symbol for root in jsonapi, fix tests
2015-03-22 20:38:29 -04:00
Mateo Murphy
3ba4386bda
Root is always "data" for jsonapi
2015-03-22 20:37:25 -04:00
Guillermo Iguaran
b68d7f4826
Merge pull request #852 from mateomurphy/serializer-options-fix
...
Fix options merge order in `each_association`
2015-03-22 18:54:07 -05:00
Mateo Murphy
03372ea61d
Fix options merge order in each_association
...
Custom association serializers were getting clobbered when using an each serializer.
2015-03-20 00:22:46 -04:00
Mateo Murphy
ca985e1afd
Use association value for determining serializer used
...
Ensures overridden association value works when orignal association does not return a result.
2015-03-19 23:28:00 -04:00
Alexandre de Oliveira
0446a9714d
Merge pull request #833 from lsylvester/cache-serializers-for-class
...
Cache serializers for class
2015-03-13 19:55:49 -03:00
Alexandre de Oliveira
af81a403e3
Passes serializer options down into associations
2015-03-11 16:37:14 -03:00
Alexandre de Oliveira
bcd3844e58
Stores passed in options in array serializers
...
This is supported in single serializers. This adds support for passing
options from array serializers to each serializer in it.
2015-03-11 16:14:09 -03:00
Guillermo Iguaran
73aeba4177
Merge pull request #836 from rails-api/stores-passed-in-options
...
Makes passed in options accessible inside serializers
2015-03-11 13:21:36 -05:00
Alexandre de Oliveira
48650ecf7e
Makes passed in options accessible inside serializers
...
In some cases, we want to pass arguments from the controller and we want
to serializer a resource according to that. This allows serializers to
use the `options` method to retrieve whatever was passed in via
arguments.
2015-03-11 14:53:57 -03:00
Robbie Pitts
ad5677c4ec
Make json api adapter 'include' option accept an array, accommodate comma delimited string for legacy reasons
2015-03-11 10:01:44 -04:00
Lachlan Sylvester
980d1ced81
add explicit thread_safe dependency
2015-03-11 11:15:17 +11:00
lsylvester
2b0c5ee084
clear the cache between requests
2015-03-11 09:53:47 +11:00
lsylvester
3fb560908e
cache the serializers for a class
2015-03-11 09:53:47 +11:00
Guillermo Iguaran
d55f3b33b4
Merge pull request #811 from mateomurphy/scope
...
Reimplement serialization scope and scope_name
2015-03-10 10:16:06 -05:00
Gary Gordon
651b99f22e
Support has_one to be compatible with 0.8.x
...
Update README and CHANGELOG
2015-03-01 13:47:34 -05:00
Will Jordan
f2ee544a88
Fix explicit serializer for associations
2015-02-24 16:01:43 -08:00
Mateo Murphy
2962f3f64e
Reimplement serialization scope and scope_name
2015-02-09 11:24:41 -05:00
Joao Moura
8a432ad2b3
Adding cache support to version 0.10.0
...
It's a new implementation of cache based on ActiveSupport::Cache.
The implementation abstracts the cache in Adapter class on a
private method called cached_object, this method is intended
to be used on Adapters inside serializable_hash method in order
to cache each instance of the object that will be returned by
the serializer.
Some of its features are:
- A different syntax. (no longer need the cache_key method).
- An options argument that have the same arguments of ActiveSupport::Cache::Store, plus a key option that will be the prefix of the object cache on a pattern "#{key}-#{object.id}".
- It cache the objects individually and not the whole Serializer return, re-using it in different requests (as a show and a index method for example.)
2015-02-02 14:53:34 -02:00
Alexandre de Oliveira
e47231cdc8
Support overriding association methods
...
You can override associations to define custom scope on them.
2015-01-29 16:52:18 -02:00
Nicolás Hock Isaza
1d7d9fd6aa
Fix nested include attributes
...
When the requests asked for a nested attribute in the `include` and it's
missing or empty, don't break because the type of the object can't be
determined.
If the request is for a collection and none of the elements has the
attribute, it will not be added to the `linked` key, similar to what
happens with simple includes.
2015-01-13 14:49:58 -05:00