mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Return null resource object identifier for blank id
Also, fix test where attributes were included when id was ""
```
1) Failure:
ActionController::Serialization::AdapterSelectorTest#test_render_using_adapter_override
[test/action_c$ntroller/adapter_selector_test.rb:53]:
--- expected
+++ actual
@@ -1 +1 @@
-"{\"data\":{\"id\":\"\",\"type\":\"profiles\",\"attributes\":{\"name\":\"Name 1\",\"description\":\"Description 1\"}}}"
+"{\"data\":null}"
```
This commit is contained in:
@@ -19,7 +19,7 @@ module ActionController
|
||||
end
|
||||
|
||||
def render_using_adapter_override
|
||||
@profile = Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
|
||||
@profile = Profile.new(id: 'render_using_adapter_override', name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
|
||||
render json: @profile, adapter: :json_api
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ module ActionController
|
||||
|
||||
expected = {
|
||||
data: {
|
||||
id: @controller.instance_variable_get(:@profile).id.to_s,
|
||||
id: 'render_using_adapter_override',
|
||||
type: 'profiles',
|
||||
attributes: {
|
||||
name: 'Name 1',
|
||||
|
||||
Reference in New Issue
Block a user