Commit Graph

1624 Commits

Author SHA1 Message Date
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
Alexandre de Oliveira
33e8d09ad0 Merge pull request #722 from ggordon/stack_level_too_deep
Fix infinite recursion
2014-11-10 12:31:14 -02:00
Gary Gordon
3925f93df2 Merge pull request #1 from metermd/master
Allow for the implicit use of ArraySerializer when :each_serializer is specified
2014-11-07 10:21:40 -05: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
Mike A. Owens
58b6c4a6b7 Allow for the implicit use of ArraySerializer when :each_serializer is specified. 2014-11-07 09:39:36 -05:00
Aaron Renoir
fc1562c04a add fields to adapter initialize function, pull in master, add tests using includes with fields 2014-11-05 18:10:37 -08:00
Aaron Renoir
c9c58e31e5 merge upstream/master 2014-11-05 16:47:15 -08:00
Gary Gordon
c84430cdad Support serializer and each_serializer in render json 2014-11-05 15:10:14 -05:00
Alexandre de Oliveira
95d122046d Merge pull request #692 from ggordon/linked_for_jsonapi_collection
Include 'linked' member for json-api collections
2014-11-04 21:59:15 -02:00
Carlos Antonio da Silva
8374396b88 Merge pull request #714 from ride/to-json-as-json
Define as_json instead of to_json
2014-11-03 22:00:36 -02:00
Guillermo Iguaran
f5411f045f Define as_json instead of to_json 2014-11-03 17:38:58 -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
Alexandre de Oliveira
80ece39dd9 Merge pull request #710 from ride/fix-empty-linked
JSON-API: Don't include linked section if associations are empty
2014-11-02 01:53:37 -02:00
Alexandre de Oliveira
deaf55eeae Merge pull request #711 from rails-api/fixes-rbx-on-travis
Fixes rbx gems bundling on TravisCI
2014-11-02 01:51:14 -02:00
Alexandre de Oliveira
3504c1a5d8 Fixes rbx gems bundling on TravisCI 2014-11-02 01:23:29 -02:00
Guillermo Iguaran
3bba334cf8 JSON-API: Don't include linked section if associations are empty 2014-10-31 14:30:59 -05:00
Alexandre de Oliveira
5acd0be287 Merge pull request #709 from ride/add-type
Add type key when association name is different than object type
2014-10-31 15:03:32 -02:00
Guillermo Iguaran
2d21a8e83f Add type when association name is different than objects type 2014-10-31 01:54:13 -05:00
Alexandre de Oliveira
462efc0ea5 Merge pull request #708 from ride/fix-for-nil-associations
Handle correctly null associations
2014-10-31 00:53:47 -02: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
Alexandre de Oliveira
baf3db1365 Merge pull request #691 from jacob-s-son/fix-embed-option-for-associations
Fix embed option for associations
2014-10-29 18:41:59 -02:00
Alexandre de Oliveira
617756623c Merge pull request #689 from ride/fix-json-api-custom-root
Fix support for custom root in JSON-API adapter
2014-10-29 15:06:13 -02:00
Aaron Renoir
be54e0bc4f remove serializer dependency from fieldset 2014-10-27 15:24:19 -07:00
Aaron Renoir
34f08477e4 fix tests, but need to understand how the serializer class attribute _associations was getting changed. 2014-10-26 14:41:14 -07:00
Aaron Renoir
39bee48ae6 implement sparse fieldsets http://jsonapi.org/format/#fetching-sparse-fieldsets 2014-10-26 13:04:14 -07:00
Edgars Jekabsons
f9b7c74235 Renamed embed test to have "test" suffix
Fixed reference to association options
2014-10-22 15:30:44 +03:00
Guillermo Iguaran
5f198667be Fix support for custom root in JSON-API adapter 2014-10-22 04:01:12 -03:00
Steve Klabnik
47deb87e81 Merge pull request #685 from ride/ids-as-strings-2
Serialize ids as strings in JSON-API adapter
2014-10-20 11:22:09 -04:00
Guillermo Iguaran
7c030314cb Serialize ids as strings in JSON-API adapter 2014-10-15 18:56:49 -05:00
Steve Klabnik
9360a10ce2 Merge pull request #684 from ride/array-serializer
Refactor adapters to implement support for array serialization
2014-10-15 19:39:50 -04:00
Guillermo Iguaran
557b56a50e Refactor adapters to implement support for array serialization 2014-10-15 17:35:50 -05:00
Steve Klabnik
efea975419 Merge pull request #682 from ride/json-api-root
Include root by default in JSON-API serializers
2014-10-14 14:19:32 -04:00
Guillermo Iguaran
b91a86b401 Add test for serialization for adapters with root by default 2014-10-14 12:42:21 -05:00
Guillermo Iguaran
3fa1116035 Include root by default in JSON-API serializers 2014-10-14 11:33:06 -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
Steve Klabnik
410eacc30e Merge pull request #677 from ride/embed-ids-option
Add support for embed: :ids option for in associations
2014-10-14 11:39:09 -04:00
Steve Klabnik
341cca7d8a Merge pull request #681 from quainjn/inherited-serializer
Check superclasses for Serializers
2014-10-14 11:36:02 -04:00
Steve Klabnik
9d344b1dd7 Merge pull request #680 from NullVoxPopuli/add-root-option
Add support for root keys
2014-10-14 04:06:50 -04:00
Jake Quain
c0166f3026 Check superclasses for Serializers 2014-10-13 17:39:54 -06:00
NullVoxPopuli
7338b62b02 add support for root keys
remove debugging gem

fix white space
2014-10-13 13:27:09 -04:00
Guillermo Iguaran
188336522f Add support for embed: :ids option for in associations 2014-10-10 16:48:55 -05:00
Steve Klabnik
97023db904 Merge pull request #675 from tricknotes/support-rails4.2
Support Rails 4.2.0
2014-10-09 12:39:07 -04:00