Skip to content

Commit 6775bdd

Browse files
committed
Update top-level link with PR rails-api#1247
update according rubocop rules
1 parent ae547bf commit 6775bdd

File tree

5 files changed

+15
-142
lines changed

5 files changed

+15
-142
lines changed

docs/README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ This is the documentation of ActiveModelSerializers, it's focused on the **0.10.
2424
- [Using ActiveModelSerializers Outside Of Controllers](howto/outside_controller_use.md)
2525
- [How to add top-level links](howto/add_top_level_links.md) (```JSON-API``` only)
2626

27-
## Getting Help
28-
29-
If you find a bug, please report an [Issue](https://github.com/rails-api/active_model_serializers/issues/new).
30-
31-
If you have a question, please [post to Stack Overflow](http://stackoverflow.com/questions/tagged/active-model-serializers).
32-
33-
Thanks!
34-
>>>>>>> Adds support for top-level links to JsonApi adapter
35-
3627
## Integrations
3728

3829
| Integration | Supported ActiveModelSerializers versions | Gem name and/or link

lib/active_model/serializer/adapter/json_api/links.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

test/action_controller/serialization_test.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@ def render_array_using_implicit_serializer_and_meta
4747

4848
def render_array_using_implicit_serializer_and_links
4949
with_adapter ActiveModel::Serializer::Adapter::JsonApi do
50-
5150
@profiles = [
52-
Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
51+
Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
5352
]
5453

55-
render json: @profiles, links: { self: "http://example.com/api/profiles/1" }
54+
render json: @profiles, links: { self: 'http://example.com/api/profiles/1' }
5655
end
5756
end
5857

@@ -272,15 +271,15 @@ def test_render_array_using_implicit_serializer_and_links
272271
data: [
273272
{
274273
id: assigns(:profiles).first.id.to_s,
275-
type: "profiles",
274+
type: 'profiles',
276275
attributes: {
277-
name: "Name 1",
278-
description: "Description 1"
276+
name: 'Name 1',
277+
description: 'Description 1'
279278
}
280279
}
281280
],
282281
links: {
283-
self: "http://example.com/api/profiles/1"
282+
self: 'http://example.com/api/profiles/1'
284283
}
285284
}
286285

test/adapter/json_api/links_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ def test_toplevel_links
4343
assert_equal(expected, hash[:links])
4444
end
4545

46+
def test_nil_toplevel_links
47+
hash = ActiveModel::SerializableResource.new(
48+
@post,
49+
adapter: :json_api,
50+
links: nil
51+
).serializable_hash
52+
assert_equal(nil, hash[:links])
53+
end
54+
4655
def test_resource_links
4756
hash = serializable(@author, adapter: :json_api).serializable_hash
4857
expected = {

test/adapter/json_api/top_level_links_test.rb

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)