Commit Graph

1440 Commits

Author SHA1 Message Date
Benjamin Fleischer
847f50a13c Merge pull request #1984 from bf4/make_test_attributes_explicit
Make test attributes explicit
2016-12-06 14:53:13 -06:00
Benjamin Fleischer
3b84845241 Add CHANGELOG 2016-12-04 19:33:39 -06:00
Benjamin Fleischer
f8ca912de8 Add failing test for AMS::Model accessor vs. attributes mutation 2016-12-04 19:33:39 -06:00
Benjamin Fleischer
80af763d2e Make test attributes explicit
- Organize test poros with associations and by serializer
- Freeze derived attributes/associations against mutation
- Cleanup PORO fixtures
2016-12-04 19:33:39 -06: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
e575156fe7 Merge pull request #1992 from ojiry/bump_ruby_versions
Run tests by Ruby 2.2.6 and 2.3.3
2016-12-03 15:45:08 -05:00
Ryoji Yoshioka
095ad9c82c Run tests by Ruby 2.2.6 and 2.3.3 2016-12-04 00:20:24 +09:00
Benjamin Fleischer
9b25680514 Merge pull request #1990 from mxie/mx-result-typo
Fix typos and capitalization in Relationship Links docs [ci skip]
2016-11-29 13:29:22 -06:00
Melissa Xie
3733efaf99 Use consistent capitalization for JSONAPI adapter references 2016-11-29 10:41:16 -05:00
Melissa Xie
4f72cc7d8c Fix "result" typo 2016-11-29 10:38:12 -05:00
Benjamin Fleischer
93bbc59e14 Merge pull request #1982 from bf4/better_ams_model_interface
Better AMS Model attributes interface
2016-11-21 09:18:38 -06:00
Benjamin Fleischer
772b7999c5 Better AMS Model attributes interface 2016-11-21 09:14:26 -06:00
Benjamin Fleischer
cd09e89006 Bump to 0.10.3 2016-11-21 08:55:22 -06:00
Alex Popov
d39dd04c11 Update SerializableResource documentation (#1977)
Mention that ActiveModelSerializers::SerializableResource.new can be used for
single resource as well as for collections
2016-11-17 13:57:07 +01:00
L. Preston Sego III
d31d741f43 Make serializer lookup configurable (#1757) 2016-11-16 18:38:40 +01:00
Yohan Robert
d0de53cbb2 Fix namespace lookup for collections and has_many (#1973) 2016-11-15 08:35:58 -05:00
L. Preston Sego III
c9a96a05ed Trigger 2016-11-09 08:05:10 -05: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
Lucas Hosseini
cb20b957ed Pin jsonapi version. (#1955) 2016-10-25 07:43:40 -04:00
Benjamin Fleischer
6c6e45b23f Replace fail/rescue CollectionSerializer::NoSerializerError with throw/catch :no_serializer (#1767) 2016-09-26 10:18:27 -04:00
Benjamin Fleischer
c69855bfaa Improve readability of relationships test (#1904)
* Really fix intermittent relationship test failures

* Unify the two JSON API relationship test files

I accidentally introduced the duplication when
merging
https://github.com/rails-api/active_model_serializers/pull/1543#issuecomment-193118782
and they've evolved separately since then.

They both have some value and need to be combined.

* Resolve duplicate tests from diverged tests files

* No longer test Association/Relationship interface directly
2016-09-26 09:23:40 -04:00
Lee Richmond
2145540795 Add include_data :if_sideloaded (#1931)
For JSONAPI, `include_data` currently means, "should we populate the
'data'" key for this relationship. Current options are true/false.

This adds the `:if_sideloaded` option. This means "only
populate the 'data' key when we are sideloading this relationship." This
is because 'data' is often only relevant to sideloading, and causes a
database hit.

Addresses https://github.com/rails-api/active_model_serializers/issues/1555
2016-09-25 12:57:19 -04:00
L. Preston Sego III
6ed499f38e added active record benchmark (#1919)
* added active record benchmark

* address bf4's feedbock

* fix spacing
2016-09-24 16:39:29 -04:00
Brendon Muir
0606b06abd Update upgrade_from_0_8_to_0_10.md (#1933)
Update upgrade_from_0_8_to_0_10.md

Changes the upgrade guide to highlight the change in the way relationships are walked.
2016-09-20 13:38:53 -04:00
Lee Richmond
a77dfdaa85 Ensure valid jsonapi when blank relationship (#1930)
If you specify include_data false, and do not have any links for this
relationship, we would output something like:

`{ relationships: { comments: {} } }`

This is not valid jsonapi. We will now render

`{ relationships: { comments: { meta: {} } } }`

Instead.

Relevant jsonapi spec: http://jsonapi.org/format/#document-resource-object-relationships
2016-09-19 14:10:50 -04:00
Lee Richmond
a032201a91 Merge pull request #1922 from ggpasqualino/master
Make railties an optional dependency
2016-09-14 09:00:30 -07:00
L. Preston Sego III
810efb838d add bm_adapter (#1914) 2016-09-13 11:20:20 -04:00
Guilherme
e8f055a682 Add chengelog entry about the issue 2016-09-13 17:16:43 +02:00
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