Commit Graph

1353 Commits

Author SHA1 Message Date
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
44128a5d23 Merge pull request #1769 from remear/upgrade-rubocop
Upgrade to rubocop ~> 0.40.0
2016-06-01 19:51:10 +02:00
Ben Mills
d900b09f8d
Upgrade to rubocop ~> 0.40.0 2016-06-01 09:21:29 -06:00
Benjamin Fleischer
f2f747edda Merge pull request #1765 from bf4/serializer_cleanup_3
Remove unnecessary Serializer#cached_fields; Extracted cached_attributes
2016-06-01 01:41:42 -05:00
Benjamin Fleischer
385abb4ba0 Simplify Serializer#cached_attributes to take a fields argument 2016-06-01 01:02:17 -05:00
Benjamin Fleischer
ba23de686d Complete extracting to Serializer#cached_attributes 2016-06-01 01:02:13 -05:00
Benjamin Fleischer
96750b2f9a Remove unnecessary Serializer#cached_fields 2016-06-01 00:47:10 -05:00
Benjamin Fleischer
eb86663393 Remove unnecessary Adapter::Base#resource_object_for 2016-06-01 00:43:24 -05:00
Benjamin Fleischer
fcfbc0d529 Merge pull request #1764 from bf4/serializer_cleanup_2
Remove unnecessary Adapter::Base#cache_attributes
2016-06-01 00:42:54 -05:00
Benjamin Fleischer
3f38a60d89 Merge pull request #1763 from bf4/serializer_cleanup_1
Remove unnecessary Adapter::Base#cache_check
2016-06-01 00:37:23 -05:00
Benjamin Fleischer
ee518e1856 Remove unnecessary Adapter::Base#cache_attributes 2016-06-01 00:35:11 -05:00
Benjamin Fleischer
0cc87fde40 Remove unnecessary Adapter::Base#cache_check 2016-06-01 00:15:29 -05: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
Benjamin Fleischer
6e609c1218 Merge pull request #1760 from bf4/remove_dead_file
Remove IncludeTree; missing from #1685
2016-05-31 07:57:18 -05:00
Benjamin Fleischer
5a4eef6cea Remove IncludeTree; missing from #1685 2016-05-30 23:08:23 -05:00
Ryunosuke Sato
4f085441bd Update README to write how to configure adapter (#1758) 2016-05-30 15:43:00 -04:00
Lucas Hosseini
f48fd2a327 Extract IncludeTree. (#1685) 2016-05-28 10:07:11 -04:00
Ben Mills
f2cb497fe3 Add key transform performance note to docs (#1753) 2016-05-26 16:19:19 -04:00
Ben Mills
4de8d8c16a Remove default key case change message (#1752) 2016-05-26 15:15:30 -04:00
L. Preston Sego III
7d7329bbcf Merge pull request #1426 from brigade/default-include
Add a default_include_tree config variable to ActiveModel::Serializer
2016-05-26 13:31:53 -04:00
Ben Mills
9cffc10208
Add Rails >= 5.0.beta3 JSON API params parsing (#1751)
This reverts commit 6288203277.
2016-05-26 11:19:23 -06:00
Ben Mills
6288203277 Revert "Add Rails >= 5.0.beta3 JSON API params parsing" (#1751) 2016-05-26 11:17:32 -06:00
Noah Silas
94db09b3f6 Fix RuboCop 0.40 linter errors (#1722)
These errors are breaking the build, which seems to use RuboCop 0.40 [1]
despite the Gemfile.lock pinning rubocop to 0.38.

New lints that I am updating the code style to reflect:

- Style/EmptyCaseCondition: Do not use empty case condition, instead use
  an if expression.

- Style/MultilineArrayBraceLayout: Closing array brace must be on the
  same line as the last array element when opening brace is on the same
  line as the first array element.

- Style/MultilineHashBraceLayout: Closing hash brace must be on the same
  line as the last hash element when opening brace is on the same line
  as the first hash element.

- Style/MultilineMethodCallBraceLayout: Closing method call brace must
  be on the line after the last argument when opening brace is on a
  separate line from the first argument.

[1] https://github.com/bbatsov/rubocop/releases/tag/v0.40.0
2016-05-26 12:58:05 -04:00
Benjamin Fleischer
8a3196d920 Improve jsonapi mime type registration for Rails 5 (#1747) 2016-05-26 10:55:12 -06: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
Yohan Robert
a701777bd5 Prevent loading association when include_data is set to false (#1710)
This should fix #1707.
2016-05-24 20:46:22 -04:00
Ben Mills
cbca1350b9 Merge pull request #1741 from krisleech/pin-gem-version
Encourage pinning of pre-1.0.0 release [skip ci]
2016-05-23 10:15:00 -06:00
Ben Mills
835aad3c74 Merge pull request #1734 from lambda2/patch-1
Adding documentation on conditional attributes
2016-05-19 18:30:50 -06: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
Kris Leech
e30039a49b Encourage pinning of pre-1.0.0 release [skip ci] 2016-05-19 09:25:55 +01:00
Ben Mills
b5e2b41a33 Merge pull request #1736 from bf4/patch_gemspec
Correct ruby/rails version requirements in gemspec
2016-05-18 12:36:37 -06:00
Benjamin Fleischer
fde4f6776d Update README/CHANGELOG 2016-05-18 10:23:10 -05:00
Benjamin Fleischer
b089a7277d Correct ruby/rails version requirements in gemspec 2016-05-18 10:16:05 -05: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
Ben Mills
b75db81ca4
Update README. 0.10 is no longer RC 2016-05-17 13:13:53 -06:00
Ben Mills
b6d4ec03de
Bump to v0.10.0 2016-05-17 12:49:37 -06:00
Ben Mills
660e982c72 Merge pull request #1726 from cgmckeever/nesting-polymorphs
adds polymorphic option to association definition which includes asso…
2016-05-17 12:25:10 -06:00
cgmckeever
5e35b7bf4c adds mac files to .gitignore (#1728) 2016-05-17 13:51:26 -04:00
cgmckeever
ec23518eb9 adds prompt for version script and a little more documentation (#1729)
better version handling

looks up via yml
2016-05-17 13:50:18 -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
Benjamin Fleischer
6c321cd862 Assert Schema (#1677)
* Assert Schema

* Fix regression from #1695 where JSONAPI renders empty meta

* Add changelog
2016-05-17 13:22:38 -04:00
Benjamin Fleischer
9f59398f2b Merge pull request #1732 from remear/jsonapi-renderer
Include ControllerSupport on ActiveSupport on_load action_controller
2016-05-17 12:10:17 -05:00
Benjamin Fleischer
7fcac0c536 Merge pull request #1697 from bf4/minitest_assertion_exception
Include actual exception message with custom exceptions
2016-05-17 10:56:59 -05:00
Ben Mills
7356071ea0
Include ControllerSupport on ActiveSupport on_load action_controller 2016-05-17 09:39:30 -06:00
Benjamin Fleischer
93cad825b7 Include actual exception message with custom exceptions 2016-05-17 10:32:53 -05:00
Benjamin Fleischer
d0d7af470c Test::Schema exceptions should be Minitest::Assertions 2016-05-17 10:31:35 -05:00
Ben Mills
070d58eacf Merge pull request #1723 from remear/rubocop-0_39_0
Pin rubocop to 0.39.0
2016-05-10 18:43:01 -06:00
Ben Mills
446c2d486c
Pin rubocop to 0.39.0 2016-05-10 18:25:01 -06:00
Yohan Robert
2b49899351 Merge pull request #1712 from bf4/fix_jsonapi_response_header
Setting the content_type sets the response Content-Type
2016-05-02 11:38:53 +02:00
Benjamin Fleischer
05fd59644d Setting the content_type sets the response Content-Type
Otherwise we have two headers, 'Content-Type' and 'CONTENT_TYPE'.
I don't know when Rails decides to use one or the other.
2016-05-01 23:30:52 -05:00