Commit Graph

102 Commits

Author SHA1 Message Date
Konstantin Munteanu
0d3999c36d Support conditions in link statements 2018-10-25 09:45:34 +02:00
Alvin Crespo
3a200d7fe1
Minor doc update
Use model.class.name to do the correct comparison
2018-09-07 14:28:21 -04:00
Abhay Nikam
4559774d60 Updated the defination for the class_name in documentation 2018-06-21 08:49:33 +05:30
Abhay Nikam
993a48fdcf wordsmitting 2018-06-07 10:05:21 +05:30
Abhay Nikam
65cf4836c8 Updated class_name defination. 2018-06-07 10:04:03 +05:30
Abhay Nikam
f3b202746b Added examples to use class_name options for association. 2018-06-07 09:58:48 +05:30
Benjamin Fleischer
3dd6cccb4d Fix 0.10.6 regression; make using belongs_to on self opt-in 2017-11-13 08:36:23 -06:00
Todd Morningstar
0bbeeb384e Update serializers.md
* Add note that any controller reference is acceptable for `serialization_scope`
 * Add note about `ActionController::API` and `view_context` set to `nil`, with respect to accessing helpers in a Serializer
 * refs #2144
 * Update CHANGELOG.md
2017-10-31 17:15:43 -04:00
Nate Pinsky
88367da970 Add warnings about global adapter config to docs (#2176) 2017-10-24 17:30:56 -05:00
Joel Tanner Jones
622872ae2b Fix dead link in docs/general/rendering
The add_pageination_links.md is dead in docs/general/rendering on the
0-10-stable branch.
2017-06-13 13:28:24 -04:00
Benjamin Fleischer
ec7b5859f7 Document namespace 2017-05-01 10:25:14 -05:00
Benjamin Fleischer
96028a7b99 Document new reflection options; support :foreign_key 2017-05-01 10:18:13 -05:00
Cassidy K
aa619b5e0e Update Serializers and Rendering Docs
- Updating general/serializers.md
- Updating docs/general/rendering.md
- adding to changelog
- Updating rendering.md to indicate that `each_serializer` must be used on a collection
- updating my handle in previous changelog entry
2017-04-19 11:29:20 -04:00
Timur
1a5e66b933 [0.10] add docs for include (#2081)
* Add docs for `include` option in the adapter
2017-03-28 02:16:45 -05:00
Ryunosuke Sato
cec6478f32 Fix example code in doc/general/getting_started.md
The `belongs_to` method should take relation name, not a foreign_key property.
2017-03-24 10:40:27 +09:00
Akiicat
19f8ada4af Update serializers.md 2017-02-28 05:23:19 +08:00
MSathieu
ab98c4a664 Update logging.md 2017-01-22 13:14:19 +01:00
MSathieu
3d44bfcf28 Update logging.md 2017-01-17 18:21:21 +01:00
MSathieu
68f8ebedf4 Update logging.md 2017-01-17 17:43:22 +01:00
Benjamin Fleischer
15a8f2c1eb Promote important architecture description that answers a lot of questions we get 2016-12-04 15:26:44 -06:00
L. Preston Sego III
d31d741f43 Make serializer lookup configurable (#1757) 2016-11-16 18:38:40 +01:00
L. Preston Sego III
b29395b0ac This adds namespace lookup to serializer_for (#1968)
* This adds namespace lookup to serializer_for

* address rubocop issue

* address @bf4's feedback

* add docs

* update docs, add more tests

* apparently rails master doesn't have before filter

* try to address serializer cache issue between tests

* update cache for serializer lookup to include namespace in the key, and fix the tests for explicit namespace

* update docs, and use better cache key creation method

* update docs [ci skip]

* update docs [ci skip]

* add to changelog [ci skip]
2016-11-09 07:57:39 -05:00
Julia
b709cd41e6 Improve type method documentation (#1967) 2016-11-04 16:49:48 +01:00
大野峻典
ce8dd36633 Add documentation for root (#1959) 2016-11-01 19:25:52 +01:00
Mario Olivio Flores
1899437566 Add info on setting polymorphic serializers (#1906)
While this same document provides details on how to override the
serializer_for, not all users will realize this could be used to set the
sterilizers for polymorphic relationships.  This change just adds a link
to that documentation and makes that point obvious.
2016-09-07 15:22:08 -04:00
Benjamin Fleischer
d34069b6ae Merge pull request #1799 from ScottKbka/patch-1
Update rendering.md
2016-08-31 16:18:47 -05:00
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
Scott Kobewka
7178b9de7b Documenting Adapter. Fixing typo in association.rb documentation. 2016-08-17 20:24:36 -04: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
Edward Andrews-Hodgson
be8f136d15 Add warning in caching documentation 2016-08-04 17:17:00 +01:00
bluehallu
4ff33a7ad1 Fix typo (#1855) 2016-07-24 15:49:38 -04:00
Yogesh Khater
156dc232ce Add doc for setting conditional serialization_scope 2016-06-30 17:14:58 +05:30
Luiz Eduardo Kowalski
d27b21a733 Add docs for the fields option 2016-06-24 07:09:21 +02:00
Scott Kobewka
43b6bae7fe Fixing typo in Serializers guide for including a block after 2016-06-14 14:27:23 -04:00
Benjamin Fleischer
5017bb7f2e Fix spelling
```
cat <<  'EOF' > .git/hooks/pre-push

bundle exec rake rubocop

if command -v misspell >/dev/null; then
  misspell  -w -error -source=text {app,config,lib,spec,test,docs,bin}/**/* 2>/dev/null
fi

EOF
chmod +x .git/hooks/pre-push
```
2016-06-09 03:41:01 -05:00
Spencer Oberstadt
998ca55e3d Fix docs for deserialization (#1768)
I found in the tests that deserialization expects relationships to be under a `relationships` key.
https://github.com/rails-api/active_model_serializers/blob/master/test/action_controller/json_api/deserialization_test.rb#L68
2016-06-01 16:50:15 -04:00
Yohan Robert
b8af2892f7 [skip ci] Fix root key documentation (#1761)
The current documentation stated that it was not possible to override
the root key for the JSON adapter. This was removed from the
documentation and it now links the useful documentation pages.
2016-05-31 13:30:47 -06:00
Ben Mills
f2cb497fe3 Add key transform performance note to docs (#1753) 2016-05-26 16:19:19 -04:00
Ben Woosley
8c18d18cdb Add default_includes configuration
This is useful to set application-wide default behavior - e.g. in
previous versions of AMS the default behavior was to serialize the
full object graph by default - equivalent to the '**' include tree.

Currently just the global setting, but I think this could also work
on a per-serializer basis, with more attention.
2016-05-26 00:16:14 +00:00
André Aubin
efdee6041b Adding documentation on conditional attributes
Adding documentation and short example ([from this pull request](https://github.com/rails-api/active_model_serializers/pull/1403)) on conditional attributes.

Adding lambda literal notation and example.

Adding lambda literal notation and example, and fixing typo.

Removing PR reminder

Adding Changelog entry

Moving CHANGELOG entry under master (unreleased)

Use option instead of parameter
2016-05-20 00:47:53 +02:00
cgmckeever
ec15fa9de3 Adds documentation for overriding default serializer based on conditions (#1730)
suggested changes

update changelog
2016-05-17 15:28:54 -04:00
cgmckeever
bbed12864d adds polymorphic option to association definition which includes association type in serializer
regen gemlock

regen gemlock

better variable naming

rubocop fixes

adds to changelog

adds empty relationship and has_many polymorph tests

indent

test cleaning

-rubocop

rubocop

rubocop

rubocop

changelog

remove silly .DS

fix roque failure

fix
2016-05-17 12:30:59 -05:00
Fumiaki MATSUSHIMA
aa087a22b5 String/Lambda support for conditional attributes/associations 2016-04-26 21:37:25 +09:00
Lucas Hosseini
4c0e2dcb28 Fix example in docs/general/deserialization.md. 2016-04-18 01:04:50 +02:00
Michał Zając
dcc7af925d Update serializers.md 2016-04-11 14:52:07 +02:00
Benjamin Fleischer
afe3c93807 Add more association documentation (#1635)
[DOC] Add more association documentation
2016-04-10 12:44:37 -05:00
Ben Mills
3498647d1a Apply key transforms to keys referenced in values 2016-04-04 10:16:04 -06:00
Chris Peters
dba85f2720 #1594 - Document generator's auto-extending of (if it exists) 2016-04-02 13:18:07 -04:00
Krzysztof Rybka
37e0fdb0ee Remove wrong quoting in serializers guide 2016-03-31 14:56:07 +02:00
Benjamin Fleischer
fa7b3afbfd Prefer explicitly yielding the serializer, per groyoh 2016-03-30 14:01:28 -05:00