Commit Graph

1337 Commits

Author SHA1 Message Date
Ian C. Anderson
2423ca4999 Support key transformation for Attributes adapter (#1889)
The `:attributes` adapter is the default one, but it did not support
key transformation. This was very surprising behavior, since the
"Configuration Options" page in the guides didn't mention that this
behavior was not supported by the attributes adapter.

This commit adds key transform support to the attributes adapter, and
adds documentation about the default transform for the attributes
adapter (which is `:unaltered`).

This commit also handles arrays when transforming keys, which was needed
in the case where you're serializing a collection with the Attributes
adapter. With the JSON adapter, it was always guaranteed to pass a hash
to the KeyTransform functions because of the top-level key. Since there
is no top-level key for the Attributes adapter, the return value could
be an array.
2016-08-25 15:21:27 -04:00
Patsy Issa
77a4a27757 Updated to use lazy loading when requiring 2016-08-24 10:42:01 +03:00
johnnymo87
f96d97d3e9 Correct comment 2016-08-22 13:10:29 +00:00
Patsy Issa
714c620ea2 Updated to use the proper renderer 2016-08-22 12:32:22 +03:00
Benjamin Fleischer
49ee823a53 Merge pull request #1886 from isratrade/fix-readme-docs-link
Fix broken link on README to docs for v0.10.x
2016-08-21 09:48:25 -05:00
Joseph Magen
d4b1e4e924 Fix broken link on README to docs for v0.10.x 2016-08-18 17:28:56 +03:00
Scott Kobewka
7178b9de7b Documenting Adapter. Fixing typo in association.rb documentation. 2016-08-17 20:24:36 -04:00
Benjamin Fleischer
455068d455 Merge pull request #1884 from bf4/simplify_relationship
* Simplify Relationship
2016-08-17 16:18:14 -05:00
Benjamin Fleischer
26bcdbe44a Clean up docs 2016-08-17 16:16:13 -05:00
Benjamin Fleischer
a0dd5e58cc Merge branch 'xn-patch-1' 2016-08-17 16:13:37 -05:00
L. Preston Sego III
a319fef239 Add tests for fields option demonstrating usage on both attributes and relationships (#1839)
* add test for fields whitelisting relationships, and use the JSON API Include Directive to do the heavy lifting
2016-08-17 16:12:12 -05:00
Benjamin Fleischer
abb15b9622 Simplify Relationship 2016-08-17 15:58:11 -05:00
Benjamin Fleischer
d66e272994 Correct typos 2016-08-16 18:18:58 -05:00
Yevhen Shemet
1896e5a525 ActiveModelSerializers::Model successor initialized with string keys fix (#1881) 2016-08-16 06:49:10 -04:00
Mark Abramov
5f3bdcc87c Use ActiveSupport::Cache.expand_cache_key for cache key expansions (#1878)
* Use ActiveSupport::Cache.expand_cache_key for cache key expansions
2016-08-13 16:59:36 -05:00
L. Preston Sego III
6de3f31b6e Namespace separator setting for json-api and tests (#1874)
Adds jsonapi_namespace_separator configuration

Also:

* Enable getting type from record class without serializer

Needs Followup:

- https://github.com/rails-api/active_model_serializers/pull/1874#discussion_r74607042 
- https://github.com/rails-api/active_model_serializers/pull/1874#discussion_r74607734
2016-08-12 12:54:42 -05:00
Benjamin Fleischer
9217bc2ec4 Merge pull request #1844 from bkoltai/bk_upgrade_0_8_to_0_10_doc
Add documentation on upgrading from `0.8` to `0.10` safely
2016-08-08 20:54:34 -05:00
Benjamin Fleischer
e8343a9049 Merge pull request #1872 from aldreth/update-cache-documentation
Add warning in caching documentation [ci skip]

Closes #1587
2016-08-04 11:43:57 -05:00
Edward Andrews-Hodgson
be8f136d15 Add warning in caching documentation 2016-08-04 17:17:00 +01:00
Leo Correa
6567989ad7 Specify how to get the instance of the serializer (#1861)
[DOC] `SerializableResource#serializer` vs. `SerializableResource#serializer_instance` [ci skip]
2016-07-27 13:59:12 -05:00
bluehallu
4ff33a7ad1 Fix typo (#1855) 2016-07-24 15:49:38 -04:00
bkoltai
d9ba5cd768 Fix typos and make examples more explicit 2016-07-20 21:07:06 -07:00
Nirmalya Ghosh
37a17723cf Modified some code and removed unnecessary code from the ember and json api doc (#1852)
* modified some code and removed unnecessary code from the ember abd json api doc

* using es6 imports
2016-07-20 10:19:59 -04:00
L. Preston Sego III
aa4d89ab47 remove dynamic class creation where not needed (#1850)
* remove dynamic class creation where not needed
2016-07-18 14:11:09 -05:00
Avon
3ad2457aaf Bugfix/redefine associations on inherited serializers (#1848)
* replace reflection collection type with hash to prevent duplicated associations in some cases

* include tests

* Fix robucup offenses

* Improve test

* Remove usless requirement

* improve tests

* remove custom_options option from Post and InheritedPost serializer

* Improve tests

* update changelog

* update changelog
2016-07-17 16:25:43 -04:00
bkoltai
5e72ec4be7 Fix small typo 2016-07-13 10:12:41 -07:00
bkoltai
e966d07b2c PR comments
- Add list of breaking changes
- Add `true` param to `responds_to?` calls in overriden `try`
2016-07-13 10:11:19 -07:00
bkoltai
3ecc3ed0c1 Add documentation on upgrading from 0.8 to 0.10 safely 2016-07-13 09:48:07 -07:00
Yohan Robert
9a206a1f5d Remove nil relationships links (#1833) 2016-07-12 14:02:34 +02:00
Benjamin Fleischer
91b37cee2c Merge pull request #1835 from greysteil/update-changelog
Fix typo in changelog [ci skip]
2016-07-08 16:36:17 -05:00
Grey Baker
f193895f2d Fix typo in changelog 2016-07-08 22:31:10 +01:00
Benjamin Fleischer
993cc504d6 Merge pull request #1830 from bf4/rails_5
Rails 5.0 CI
2016-07-05 20:09:21 -05:00
Benjamin Fleischer
cf3cfaa924 Rails 5.0 CI 2016-07-05 17:46:14 -05:00
Benjamin Fleischer
b41df13341 Add Rails 5.0 to test matrix 2016-07-05 13:22:16 -05:00
Benjamin Fleischer
d8f3fa4bca Bump to 0.10.2 2016-07-05 13:20:24 -05:00
Benjamin Fleischer
61059e900c Merge pull request #1824 from yogeshjain999/conditional_serialization_scope_doc
Add doc for setting conditional serialization_scope [ci skip]
2016-07-05 13:12:40 -05:00
Yogesh Khater
156dc232ce Add doc for setting conditional serialization_scope 2016-06-30 17:14:58 +05:30
Benjamin Fleischer
c029c00758 Merge pull request #1802 from kyleshevlin/update_integrations_ember_and_json_api
update integration documentation for ember and JSONAPI to include…
2016-06-26 22:26:08 -05:00
Benjamin Fleischer
f4e00dc65d Merge pull request #1815 from dubadub/making-rubocop-happy
Fix code-styling issues from .rubocop_todo.yml

* re: RuboCop: Bulk minor style corrections

* re: RuboCop - hash indention corrections

* re: RuboCop - replace rocket style hashes

* re: RuboCop - get rid of redundant curly braces around a hash parameter

* re: RuboCop - Align the elements of a hash literal if they span more than one line.

* re: RuboCop - Use nested module/class definition instead of compact style.

* re: RuboCop - Suppress of handling LoadError for optional dependencies

* re: RuboCop - use include_ prefix instead of has_

* re: RuboCop - Disable Style/PredicateName rule for public API methods

* re: RuboCop - Remove empty .rubocop_todo.yml

* re: RuboCop - replace rocket style hashes
2016-06-26 22:22:55 -05:00
Francisco Quintero
e8f0dc787e Add note about will_paginate previous_page method (#1801)
* Add note about will_paginate previous_page method

Pagination_dict method in JSON adapter section refers only to kaminari prev_page. Newer version of will_paginate uses previous_page method.

* move annotation for will_paginate's previous_page method to inline comment in example methods definition
2016-06-26 22:17:21 -05:00
Luiz Eduardo Kowalski
d27b21a733 Add docs for the fields option 2016-06-24 07:09:21 +02:00
Christian Trosclair
3d48a2fbf7 Create grape integration documentation. 2016-06-22 22:38:48 -05:00
zaaroth
bcf3358524 Ensuring read_multi works with fragment cache. (#1814)
* Ensuring read_multi works with fragment cache.
2016-06-22 22:33:02 -05:00
Alexey Dubovskoy
800221ed90 re: RuboCop - replace rocket style hashes 2016-06-21 22:08:27 +01:00
Alexey Dubovskoy
26aa06284f re: RuboCop - Remove empty .rubocop_todo.yml 2016-06-20 22:19:34 +01:00
Alexey Dubovskoy
af959b0273 re: RuboCop - Disable Style/PredicateName rule for public API methods 2016-06-20 22:17:19 +01:00
Alexey Dubovskoy
ce168f9414 re: RuboCop - use include_ prefix instead of has_ 2016-06-20 22:17:01 +01:00
Alexey Dubovskoy
aa416b2fb3 re: RuboCop - Suppress of handling LoadError for optional dependencies 2016-06-20 22:15:58 +01:00
Alexey Dubovskoy
85f417f8d2 re: RuboCop - Use nested module/class definition instead of compact style. 2016-06-20 22:15:20 +01:00
Alexey Dubovskoy
8a2beacb6f re: RuboCop - Align the elements of a hash literal if they span more than one line. 2016-06-20 22:14:56 +01:00