Benjamin Fleischer
79653ac733
Replace has_one with attribute in template
2015-02-25 14:20:18 -06:00
Will Jordan
f4eb33d6e9
Update test_includes_linked_comments with correct expected result
2015-02-24 18:46:04 -08:00
Will Jordan
f2ee544a88
Fix explicit serializer for associations
2015-02-24 16:01:43 -08:00
Mateo Murphy
232e367560
Add serialization_scope_name_test
2015-02-12 17:48:43 -05:00
Mateo Murphy
2962f3f64e
Reimplement serialization scope and scope_name
2015-02-09 11:24:41 -05:00
Guillermo Iguaran
a8243761fe
Merge pull request #807 from alexstophel/update-readme
...
Add Overriding attribute methods section to README.
2015-02-07 17:16:34 -05:00
Alex Stophel
13243f2e70
Add Overriding attribute methods section to README.
2015-02-07 00:09:50 -05:00
Alexandre de Oliveira
5680436f9e
Merge pull request #693 from joaomdmoura/cache-support
...
Cache Support at AMS 0.10.0
2015-02-04 10:38:25 -02: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
Vladimir Lyzo
54d6696e7c
Fix lost test test_include_multiple_posts_and_linked
2015-01-31 19:44:22 +03:00
Guillermo Iguaran
42644544e1
Merge pull request #792 from rails-api/association-overrides
...
Association overrides
2015-01-30 09:01:49 -05:00
Alexandre de Oliveira
ba1905a915
Merge pull request #794 from carlesjove/to_param
...
add to_param for correct URL generation
2015-01-30 11:06:33 -02:00
Carles Jove i Buxeda
637113ecd5
add to_param for correct URL generation
2015-01-30 11:08:08 +01:00
Alexandre de Oliveira
e771e637bf
Updates CHANGELOG to include association overriding
2015-01-29 16:52:39 -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
Guillermo Iguaran
652493848a
Merge pull request #774 from nhocki/fix_nested_linked_objects
...
Fix nested include attributes
2015-01-13 17:01:23 -05: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
Guillermo Iguaran
22202a115a
Lets keep the assert_equal without parens for consistency.
2015-01-11 16:21:20 -05:00
Guillermo Iguaran
7085afe714
Merge pull request #771 from sweatypitts/master
...
Make linked resource type names consistent with root names
2015-01-11 16:20:15 -05:00
Robbie Pitts
b626ec8f14
Spec for linked resource type name demodulization
2015-01-11 16:10:02 -05:00
Robbie Pitts
90023b1af7
Make linked resource type names consistent with root names
2015-01-11 14:24:01 -05:00
Alexandre de Oliveira
6eb75af96b
Merge pull request #696 from ggordon/explicit_serializer
...
Explicitly set serializer for associations
2015-01-06 09:57:07 -02:00
Alexandre de Oliveira
87f817943a
Merge pull request #700 from arenoir/sparse_fieldsets
...
sparse fieldsets
2015-01-06 09:38:51 -02:00
Guillermo Iguaran
3a60633545
Merge pull request #768 from rails-api/adds-meta
...
Adds support for meta attribute
2015-01-05 00:10:09 -05:00
Alexandre de Oliveira
bd27da1b76
Adds support for meta attribute
...
Currently, 0.10.0.pre doesn't support `meta` option in `render`. This
way, there's no way to support features such as pagination. `0.9` had
this feature in place.
This adds support for it, as well as fixes small things in README.md.
This won't support `meta` in array responses because arrays don't have
keys, obviously. Also, the response should have a `root` key, otherwise
no `meta` will be included.
In some cases, for example using JsonApi, ArraySerializer will result in
a response with a `root`. In that case, `meta` will be included.
2015-01-05 02:56:33 -02:00
Steve Klabnik
282de21984
Merge pull request #753 from tricknotes/ruby-22
...
Test against Ruby 2.2 on Travis CI
2014-12-09 23:52:01 -05:00
Ryunosuke SATO
b3dc3f4dbe
Test against Ruby 2.2 on Travis CI
2014-12-10 02:40:47 +09:00
Ryunosuke SATO
2135256004
Test against latest Ruby 2.1.x on Travis CI
2014-12-10 02:40:45 +09:00
Steve Klabnik
c67da11b96
Merge pull request #745 from jockee/patch-1
...
Missing a word
2014-12-04 17:20:33 +01:00
Joakim Ekström
9768da7a70
Missing a word
2014-12-04 17:05:10 +01:00
Steve Klabnik
8bbf6b8c8b
Merge pull request #707 from jherdman/patch-1
...
A Friendly Note on Which AMS Version to Use
2014-11-20 10:27:19 -05:00
James Herdman
faa6f906d6
A Friendly Note on Which AMS Version to Use
...
Per the discussion in #702 , I figured it might be nice to note which
version of AMS is recommended to be used in new projects.
2014-11-20 10:20:04 -05:00
Alexandre de Oliveira
a933d44673
Merge pull request #730 from rails-api/fixes-nested-has-many-links
...
Fixes nested has_many links in JSONAPI
2014-11-17 11:30:20 -02:00
Aaron Renoir
2ed52f96a6
merge upstream update fieldset
2014-11-13 17:45:47 -08:00
Alexandre de Oliveira
2f5626d616
Fixes nested has_many links in JSONAPI
...
When linked resource had has_many links, all of them would use the
association from the first resource, causing all of the items to build
`links` with the same associations.
This fixes it by iterating over the serializers, not just the
attributes array.
2014-11-13 16:38:47 -02:00
Alexandre de Oliveira
c53f1da18e
Merge pull request #718 from ggordon/adapter_override
...
Allow overriding the adapter with render option
2014-11-13 13:59:12 -02:00
Gary Gordon
5560b49098
Allow overriding the adapter with render option
...
Make it easy to use multiple adapters in an app.
use "adapter: false" to not use ams
make a test override config.adapter
2014-11-13 10:23:19 -05:00
Gary Gordon
9f9715801a
Explicitly set serializer for associations
...
Document specifying serializer for assocaition
2014-11-13 10:17:59 -05:00
Alexandre de Oliveira
08fbba9087
Merge pull request #720 from ggordon/attribute_with_key
...
Rename attribute with :key (0.8.x compatibility)
2014-11-13 11:38:06 -02:00
Gary Gordon
08716d20c9
Rename attribute with :key (0.8.x compatibility)
2014-11-13 08:03:22 -05:00
Alexandre de Oliveira
ac37570bff
Merge pull request #728 from rails-api/linked-resources-use-type-as-key
...
Use type as key for linked resources
2014-11-13 10:53:59 -02:00
Alexandre de Oliveira
90b88da70a
Fixes rbx gems bundling on TravisCI
...
Fixes https://github.com/travis-ci/travis-ci/issues/2821
2014-11-13 10:35:41 -02:00
Steve Klabnik
7dd2ee8690
Merge pull request #729 from joshk/patch-2
...
Use the new beta build env on Travis
2014-11-12 18:18:04 -05:00
Josh Kalderimis
9064955499
Use the new beta build env on Travis
...
also remove the custom bundle install line as Travis does that by default
2014-11-12 14:34:34 -08: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
7333f20285
Use type as key for linked resources
...
If type is `author` but the association is called `writer`, the linked
resource key should be called `authors`, e.g
{
...
linked: {
authors: [{
...
}]
}
...
}
2014-11-12 20:03:25 -02:00
Alexandre de Oliveira
5038147c4c
Merge pull request #727 from rails-api/include-links-in-linked-resources
...
Includes links inside of linked resources
2014-11-12 19:08:50 -02:00
Alexandre de Oliveira
91b3fba509
Includes links inside of linked resources
...
According to
http://jsonapi.org/format/#document-structure-resource-objects ,
> Resource objects have the same internal structure, regardless of
> whether they represent primary or linked resources.
And then
http://jsonapi.org/format/#document-structure-resource-object-attributes ,
> There are four reserved keys in resource objects:
>
> "id"
> "type"
> "href"
> "links"
This commits includes `links` inside of linked resources.
2014-11-12 15:44:54 -02:00
Alexandre de Oliveira
7592e838ee
Merge pull request #726 from rails-api/json-api-include-with-nested-has-many
...
Bugfix: include nested has_many associations
2014-11-11 22:51:45 -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