Commit Graph

906 Commits

Author SHA1 Message Date
Yohan Robert
727d7631ae Add symbol support for ActiveModel::Serializer.type method
The ActiveModel::Serializer.type method now accepts symbol as paremeter:
class AuthorSerializer < ActiveModel::Serializer
  type :profile
end
The test file for the type was also refactored.
2016-02-19 17:05:13 +01:00
Benjamin Fleischer
f02f0849b1 Merge pull request #1525 from groyoh/remove_warning_message
Fix deprecation warning
2016-02-19 09:15:42 -06:00
Yohan Robert
c2eace3468 Fix deprecation warning
Fix the "Calling deprecated ArraySerializer... Please use
CollectionSerializer" warning that appeared when running the specs. This
happened because on of the test called ArraySerializer instead of
CollectionSerializer.
2016-02-19 10:13:54 +01:00
Benjamin Fleischer
a6c6979e08 Merge pull request #1516 from groyoh/fix_relationship_href
[FIX] bug displaying nil for relationship link href
2016-02-15 22:08:01 -06:00
Yohan Robert
3cbc0541c1 Fix bug displaying nil for relationship link href
When using the relationship link with a block, calling "meta" without "href", e.g.
has_one :bio do
  link :related do
    meta id: 1
  end
end

results in in a nil "href", e.g.
{ links: { posts: { related: { href: nil, meta: { id: 1 } }  } } }.
According to JSONAPI, we should be able to use meta without href
(http://jsonapi.org/format/#document-links).
2016-02-15 09:26:53 +01:00
Benjamin Fleischer
2b673634d9 Merge branch 'groyoh-association-blocks' 2016-02-12 14:52:21 -06:00
Benjamin Fleischer
344d09d36e Merge pull request #1472 from edwinlunando/master
[DOC] update JSON adapter pagination links how to guide
2016-02-12 14:13:40 -06:00
Benjamin Fleischer
b45f7b4ffe Add changelog for https://github.com/rails-api/active_model_serializers/pull/1372 2016-02-11 00:53:11 -06:00
Benjamin Fleischer
f1b3fe6a37 Fix rubocop config
`undefined method '[]' for nil:NilClass`
2016-02-11 00:51:23 -06:00
Benjamin Fleischer
54aa6aa499 Merge branch 'LcpMarvel-support_read_multi'
Followup:
- Changelog
2016-02-11 00:48:48 -06:00
Yohan Robert
b1fd43303c Fix relationship behavior when using block
When using the relationships DSL with a block e.g.
has_one :bio do
  link :self, "some_link"
end
the "data" field would be rendered with a nil value even though the bio
is not nil. This happened because the block return value was set to nil
but used as a value for the "data" field.
2016-02-10 21:04:37 +01:00
Yohan Robert
2c4193851b Follow up to #1454
PR #1454 was merged with some missing fixes. All these fixes are
addressed by this commit:
- Rename ActiveModel::Serializer::Adapter::JsonApi::Association to
ActiveModel::Serializer::Adapter::JsonApi::Relationship
- Move ActiveModel::Serializer::Adapter:: JsonApi::Relationship and
ActiveModel::Serializer::Adapter::JsonApi::ResourceIdentifier to
ActiveModel::Serializer::Adapter::JsonApi::ApiObjects module
- Add unit test for
ActiveModel::Serializer::Adapter::JsonApi::Relationship
- Add unit test for
ActiveModel::Serializer::Adapter::JsonApi::ResourceIdentifier
2016-02-10 12:57:54 +01:00
Benjamin Fleischer
fb48bced5e Merge branch 'add-issue-stats' 2016-02-09 22:47:40 -06:00
Benjamin Fleischer
527c2aed98 Update changelog [ci skip]
For https://github.com/rails-api/active_model_serializers/pull/1458
2016-02-09 22:38:48 -06:00
Benjamin Fleischer
a40998273d Merge branch 'CheckMateIO-bugfix/fagment-caching-breaks-type-setting'
Squashed commits that were done in other PR

Follow up needs:
- Changelog
2016-02-09 22:35:45 -06:00
Brian McManus
d67f7da114 Preserve the serializer type when fragment caching
We were not previously cloning the type setting into the dynamically
generated cached/non-cached serializers for a given fragment-cached
serializer. This led to the type generated for JsonApi having the wrong
value when fragment caching is enabled by adding either :except or :only
options to cache.

This pulls the type setting from the fragment-cached serializer forward
onto the dynamic caching classes so it is preserved in the output.
2016-02-09 22:35:32 -06:00
Benjamin Fleischer
2789cc5221 Test CachedSerializer#fragment_cached? 2016-02-09 22:31:59 -06:00
Benjamin Fleischer
4974295ee0 Merge branch 'CheckMateIO-bugfix/fix-fragment-cached-check'
Remaining issues:
- Changelog
- Test
2016-02-09 22:01:01 -06:00
Benjamin Fleischer
eedf0b64a4 Merge pull request #1505 from bf4/simplecov_fix
Update SimpleCov; remove compatibility patch
2016-02-09 21:55:03 -06:00
Benjamin Fleischer
7b98cf3e36 Update SimpleCov; remove compatibility patch
Also, SimpleCov.start already called
   SimpleCov.pid = Process.pid
So, no need for that
2016-02-09 20:59:31 -06:00
Benjamin Fleischer
fe6d2da46f Add missing changelog for #1454 [ci skip] 2016-02-08 18:17:33 -06:00
Benjamin Fleischer
1cc2e04cf6 Address issues in 50950d9533 #1340
- Add changelog entry
- Remove superseded and incorrect tests
- Fix array serialization test
2016-02-08 18:14:25 -06:00
Benjamin Fleischer
50950d9533 Merge branch 'beauby-resource-level-meta'
Followup concerns:
- https://github.com/rails-api/active_model_serializers/pull/1340/files#r47451387
- https://github.com/rails-api/active_model_serializers/pull/1340/files#r48116963
- https://github.com/rails-api/active_model_serializers/pull/1340#discussion_r47451387
- https://github.com/rails-api/active_model_serializers/pull/1340#issuecomment-164306882
- https://github.com/rails-api/active_model_serializers/pull/1340#issuecomment-166202978
- https://github.com/rails-api/active_model_serializers/pull/1340#issuecomment-173028896
2016-02-08 18:00:51 -06:00
Benjamin Fleischer
5b953ff40f Address concerns from #1018 commit c59668e 2016-02-08 17:55:15 -06:00
Benjamin Fleischer
c59668e7a8 Merge branch 'leandrocp-add-top-level-links'
Needs followup
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51733900
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51734779
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51735145
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51735218
2016-02-08 17:44:05 -06:00
Benjamin Fleischer
dcbe4ef9e2 Rubocop autocorrect indentation 2016-02-08 17:39:45 -06:00
Benjamin Fleischer
e51597480a Merge branch 'beauby-association-blocks'
Has Rubocop failures to be fixed in next commit.
2016-02-08 17:37:31 -06:00
Benjamin Fleischer
020db79a09 Merge pull request #1501 from domitian/testcases-documentation-fix
Added testcases for serializable_resource and fixed a documentation error regarding adapter key constant
2016-02-08 12:31:56 -06:00
bobba surendranath chowdary
68f09e59c4 Fixed a documentation error regarding adapter key constant, added tests
for SerializableResource::use_adapter?
2016-02-08 15:27:56 +05:30
Benjamin Fleischer
a18c99fe87 Fix typo in changelog link ref [ci skip] 2016-02-07 22:19:24 -06:00
Benjamin Fleischer
f32c0d97d5 Merge pull request #1491 from domitian/fix-documentation-links-in-readme
[DOCS] Changed the yardoc link in README.md for documentation to v.10.4
2016-02-04 15:21:31 -06:00
Benjamin Fleischer
6b50b5d92f Merge pull request #1493 from ScottKbka/patch-1
Update readme.md to link to v0.10.0.rc4
2016-02-03 09:28:28 -06:00
Leandro Cesquini Pereira
b55fc32ba2 improve doc as suggested by @bf4 2016-02-03 10:22:17 -02:00
Leandro Cesquini Pereira
37e4f1c30c Update top-level link with PR #1247
update according rubocop rules
2016-02-03 10:16:22 -02:00
Leandro Cesquini Pereira
1844c162f1 Adds support for top-level links to JsonApi adapter
http://jsonapi.org/format/#document-top-level

fix failing tests

support for top-level links limited to jsonapi adapter

Move docs from README to docs/ dir

move links to json-api adapter & create Links class to hold links data
2016-02-03 10:16:22 -02:00
bobba surendranath chowdary
7c26c1e09f Changed the yardoc link, and removed the changes to made to documentation links 2016-02-03 11:32:51 +05:30
Scott Kobewka
a86227d4ee Update readme.md to link to v0.10.0.rc4 2016-02-02 16:24:34 -05:00
bobba surendranath chowdary
211646b007 Changed the yardoc links,as old links are not taking to documentation pages,proper links for 0.10,0.9 and 0.8 in rubydoc 2016-02-02 22:39:53 +05:30
Benjamin Fleischer
72c2c9f0d7 Merge pull request #1447 from beauby/jsonapi-refactor-2016
[PERF] Refactor JsonApi adapter to avoid redundant computations.
2016-02-02 10:10:47 -06:00
Benjamin Fleischer
0edf48845b Merge pull request #1488 from nate00/require-active-support-string-inflections
[FIX] Require ActiveSupport's string inflections
2016-01-31 16:02:29 -06:00
Nate Sullivan
3c1fe0fd0f Require ActiveSupport's string/inflections
We depend on string/inflections to define String#underscore.
2016-01-31 13:45:58 -08:00
Benjamin Fleischer
f5ec8ed9d4 Reset Changelog [ci skip] 2016-01-28 21:02:40 -06:00
Benjamin Fleischer
7f261958b6 Merge pull request #1481 from wagenet/patch-2
Namespace is included in auto-registered adapters
2016-01-28 17:49:13 -06:00
Peter Wagenet
efdd466147 Namespace is included in auto-registered adapters [ci skip] 2016-01-28 15:48:18 -08:00
Benjamin Fleischer
592a5db96e Merge pull request #1479 from wagenet/patch-1
Adapters inherit from Adapter::Base
2016-01-28 16:53:19 -06:00
Peter Wagenet
75fdbfa992 Adapters inherit from Adapter::Base 2016-01-28 14:27:53 -08:00
Brian McManus
3a092c9b4b Fixed fragment_cached? method to check if caching
I noticed that fragment caching does not actually check if caching is
enabled as it seemingly should.

The way CachedSerializer#fragment_cached? worked previously would return
true even in an environment where caching was disabled as defined by
`ActiveModelSerializers.config.perform_caching`.

Added check for `_cache` like in the `cached?` method before checking
whether `_cache_only` or `_cache_except` is set.

There were no existing tests for any of these methods but it's a pretty
trivial change.
2016-01-28 13:47:17 -08:00
Benjamin Fleischer
65093055d6 Merge pull request #1310 from maurogeorge/patch-12
RFC: Primary namespace: ActiveModel::Serializer, ActiveModel::Serializers, vs. ActiveModelSerializers
2016-01-28 12:54:52 -06:00
Edwin Lunando
2678896a9c update JSON adapter pagination links 2016-01-28 13:51:19 +07:00
João M. D. Moura
58ff7535b7 releaseing new version RC4 2016-01-27 10:03:01 -05:00