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:
Benjamin Fleischer
2017-04-30 22:52:41 -05:00
parent afe0183f21
commit 73eae19b3d
3 changed files with 32 additions and 18 deletions

View File

@@ -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',