Commit Graph

1460 Commits

Author SHA1 Message Date
Guilherme
586ad64be7 Make railties an optional dependency 2016-09-09 16:07:08 +02:00
Ikariusrb
58ebf96e03 Update ember-and-json-api.md (#1894)
* Update ember-and-json-api.md

Removed ember-data adapter change to support include directives, as it's now built-in.  Updated the documentation for how to add include directives to ember store queries, and added documentation covering how to tell Rails that we are consuming and generating jsonapi data

* Fix up format for parameter restrictions

* Update ember-and-json-api.md

Updates to address comments; explain why Rails should know what format we are consuming/generating, reword introduction to include: examples, and fix render statement to specify jsonapi instead of json.
2016-09-07 16:26:33 -04: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
Filippos Vasilakis
50f27546c3 Add docs for links (#1909)
Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add controller info

Grammar fixing

Improve docs

some small wording changes

Add pr to changelog
2016-09-07 15:10:45 -04:00
Lee Richmond
11bd778f17 Merge pull request #1912 from richmolj/generator
Ensure generator picks up ApplicationSerializer
2016-09-06 12:42:37 -07:00
Lee Richmond
2ea8bb7f40 Merge pull request #1917 from richmolj/disable_pagination_links
Disable pagination links via config
2016-09-06 12:41:18 -07:00
Lee Richmond
19b5abf66e Disable pagination links via config 2016-09-06 15:06:54 -04:00
Benjamin Fleischer
f786558c48 Merge pull request #1913 from richmolj/test_gems
Add helpful testing gems
2016-09-06 13:50:40 -05:00
Alberto Miedes Garcés
050060478d Fix typo (#1916) 2016-09-06 08:42:04 -04:00
Lee Richmond
3f16b75a68 Ensure generator picks up ApplicationSerializer
ApplicationSerializer could exist, but not be loaded. So, we check
existence by looking at the filesystem instead of defined?.

Fixes https://github.com/rails-api/active_model_serializers/issues/1890
2016-09-05 19:00:25 -04:00
Lee Richmond
07dab5a054 Add helpful testing gems
Addresses https://github.com/rails-api/active_model_serializers/pull/1911#discussion_r77548416
2016-09-05 18:27:58 -04:00
Benjamin Fleischer
1dc2b74059 Merge pull request #1902 from bf4/fix_intermittent_relationship_test_failures
Fix intermittent test failures by not mutating global state
2016-08-31 21:23:47 -05:00
Benjamin Fleischer
1d4cd6f104 Fix intermittent test failures by not mutating global state
e.g.

https://ci.appveyor.com/project/bf4/active-model-serializers/build/415/job/qs8895cvla8fl0rf
 1) Failure:
 ActiveModel::Serializer::Adapter::JsonApi::RelationshipTest#test_relationship_including_data_explicit
 [C:/projects/active-model-serializers/test/adapter/json_api/relationships_test.rb:186]:
 --- expected
 +++ actual
 @@ -1 +1 @@
 -{:data=>{:id=>"1337", :type=>"authors"}, :meta=>{:name=>"Dan Brown"}}
 +{:data=>{:id=>"1337", :type=>"authors"

https://travis-ci.org/rails-api/active_model_serializers/jobs/156678147
  1) Failure:
  ActiveModel::Serializer::Adapter::JsonApi::RelationshipTest#test_relationship_with_everything
  [/home/travis/build/rails-api/active_model_serializers/test/adapter/json_api/relationships_test.rb:200]:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -{:data=>[{:id=>"1337", :type=>"likes"}],
  :links=>{:related=>{:href=>"//example.com/likes/1337",
  :meta=>{:ids=>"1337"}}}, :meta=>{:liked=>true}}
  +{:data=>[{:id=>"1337", :type=>"likes"}],
  :links=>{:related=>{:href=>"//example.com/likes/1337",
  :meta=>{:ids=>"1337"}}}}
2016-08-31 19:24:21 -05:00
Benjamin Fleischer
d34069b6ae Merge pull request #1799 from ScottKbka/patch-1
Update rendering.md
2016-08-31 16:18:47 -05:00
Benjamin Fleischer
9aaaa73a6c Merge pull request #1900 from jgrau/add-semver-section-to-readme
Add semver section to readme [ci skip]
2016-08-31 16:11:58 -05:00
Benjamin Fleischer
9108622637 Merge pull request #1901 from jgrau/code-of-conduct
Add code of conduct [ci skip]
2016-08-31 16:11:14 -05:00
CorainChicago
90805f3a4c add a code of conduct
add contact information to the code of conduct

update change log
2016-08-31 23:03:28 +02:00
jgrau
4501540b42 Add semver section to readme 2016-08-31 22:53:07 +02:00
Benjamin Fleischer
20e394d512 Refactor Association into Field like everything else (#1897)
* Make assocations asserts easier to understand

* Refactor Association into Field like everything else

* Make assocation serializer/links/meta lazier

* Push association deeper into relationship

* Simplify association usage in relationships

* Better naming of reflection parent serializer

* Easier to read association method
2016-08-31 09:35:41 -04:00
L. Preston Sego III
7d2997b3ff Organize Serializer concerns into concerns/ (#1898) 2016-08-31 06:53:51 -04:00
Benjamin Fleischer
ab85ce2b13 Merge pull request #1888 from Patsy-issa/patch-1
Updated ember integration guide to use the proper renderer
2016-08-31 01:07:30 -05:00
Benjamin Fleischer
010243484e Merge pull request #1887 from johnnymo87/correct-comment
Correct comment
2016-08-31 01:04:36 -05:00
Benjamin Fleischer
7c4ce7bcb0 Organize Serializer concerns into concerns/ 2016-08-31 00:59:48 -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
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