Commit Graph

46 Commits

Author SHA1 Message Date
Benjamin Fleischer
d315151e8a Fix warnings
JRuby-specific: fix 'warning: (...) interpreted as grouped expression'
2015-08-26 09:22:02 -05:00
Benjamin Fleischer
dca286b0ec Lead by example: lint PORO model 2015-08-18 12:59:12 -04:00
Aaron Lerch
35c8f0d835 Update fragment cache to support namespaced objects 2015-08-17 17:12:30 -04:00
Rodrigo Ra
df63b59512 Add key option to serializer associations 2015-07-05 19:47:58 -03:00
Benjamin Fleischer
1bf2825909 Remove unused PORO#to_param 2015-07-02 16:34:10 -05:00
Hugo Almeida
f25071ca70 Fixes virtual value not being used 2015-06-29 10:48:12 +09:00
Justin Aiken
3710c32cee Add some failing tests around has_many assocs...
..where no serializer is defined for the thing that is has_many'd
2015-06-26 02:16:34 -03:00
Aaron Lerch
6892ca39c9 Default the generated cache key to use custom #strftime instead of raw #to_s to achieve more accurate precision 2015-06-25 23:40:18 -04:00
Lachlan Sylvester
97e82c3eb7 use model name to determine the type 2015-06-13 19:45:46 +10:00
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
Thiago Fernandes Massa
5fac4d8f33 Update poro.rb 2015-06-05 10:50:35 +02: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
5f05944826 Merge pull request #918 from aceofsales/rescue_from
Adding rescue_with_handler to clear state
2015-05-20 23:39:45 -03: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
Ryan Schlesinger
a5db2c52c5 Clearer exception description 2015-05-20 09:19:32 -07:00
Ryan Schlesinger
9355416ad0 Add rescue_from handler to clear state
Fixes #917
2015-05-19 17:23:29 -07: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
Cristian Bica
7a62d31777 Added serializer file digest to the cache_key
Fixes #901
2015-05-06 08:37:18 +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
Mateo Murphy
9480b567ef Refactor TestUser in SerializationScopeNameTest
Use the same base class we use for other test models
2015-03-23 13:44:30 -04: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
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
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
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
Guillermo Iguaran
42644544e1 Merge pull request #792 from rails-api/association-overrides
Association overrides
2015-01-30 09:01:49 -05:00
Carles Jove i Buxeda
637113ecd5 add to_param for correct URL generation 2015-01-30 11:08:08 +01: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
Robbie Pitts
b626ec8f14 Spec for linked resource type name demodulization 2015-01-11 16:10:02 -05:00
Gary Gordon
9f9715801a Explicitly set serializer for associations
Document specifying serializer for assocaition
2014-11-13 10:17:59 -05:00
Gary Gordon
08716d20c9 Rename attribute with :key (0.8.x compatibility) 2014-11-13 08:03:22 -05:00
Alexandre de Oliveira
4af02021ac Merge pull request #703 from ggordon/specify_serializer_from_controller
Support serializer and each_serializer options in renderer
2014-11-12 20:09:51 -02:00
Alexandre de Oliveira
971f501e55 Bugfix: include nested has_many association
Currently, doing `include: author.bio` would work correctly, but not for
has_many associations such as `include: author.roles`. This fixes it.

The problem was basically that we were not handling arrays for has_many linked,
as happens for ArraySerializers.
2014-11-11 14:35:00 -02:00
Gary Gordon
d97b2f5005 Fix infinite recursion
The method for testing whether to include an association was causing
an infinite loop when two models referenced each other.
2014-11-07 10:03:31 -05:00
Gary Gordon
c84430cdad Support serializer and each_serializer in render json 2014-11-05 15:10:14 -05:00
Gary Gordon
d5bae0c2f0 Include 'linked' member for json-api collections
The options passed to the render are partitioned into adapter options
and serializer options. 'include' and 'root' are sent to the adapter,
not sure what options would go directly to serializer, but leaving this
in until I understand that better.
2014-11-03 17:13:55 -05:00
Guillermo Iguaran
2d21a8e83f Add type when association name is different than objects type 2014-10-31 01:54:13 -05:00
Guillermo Iguaran
19ac139880 Handle correctly null associations
null belongs_to associations are now serialized as nil instead
of raise an error during serialization.
2014-10-30 09:35:05 -05:00
Steve Klabnik
099f773a65 Merge pull request #625 from JordanFaust/feature/url-dsl
Add DSL for urls
2014-10-14 11:47:14 -04:00
Guillermo Iguaran
188336522f Add support for embed: :ids option for in associations 2014-10-10 16:48:55 -05:00
Jordan Faust
ad0859e262 Add DSL for urls 2014-09-01 13:44:22 -05:00
Tema Bolshakov
c1fdfc1cdc First try to implement ArraySerializer 2014-08-28 19:16:24 +04:00
Tema Bolshakov
597765e3b0 start implementing json_api adapter to understand how associations should work 2014-08-28 18:55:27 +04:00
Steve Klabnik
1ea83c8bee Implement a NullAdapter.
This adapter basically doesn't do anything, and just serializes
the attributes into plain old JSON.
2014-07-09 16:51:30 -04:00
Steve Klabnik
729a823868 Getting started: attributes.
Super super basic collection of attributes. Nothing fancy.
2014-07-09 16:16:39 -04:00