Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

prevent quoted nulls ("null") when to_json is called on nil relationship #23

Closed
wants to merge 1 commit into from

Conversation

soopa
Copy link

@soopa soopa commented Oct 21, 2011

Fixes the case where calling something like:

resource.to_json(:relationships => { :nested_resource => { :only => [:id] } })

When the nested resource returns nil, would return invalid JSON like…

{
  "id":1,
  "nested_resouce":"null"
}

Rather than valid JSON like…

{
  "id":1,
  "nested_resouce":null
}

(Note the quotes around null)

@soopa
Copy link
Author

soopa commented Nov 7, 2011

Acceptable?

@soopa
Copy link
Author

soopa commented Sep 25, 2013

Checking in, 2 years later. I've just rebased this cleanly on latest master and the build is passing.

@solnic @dkubb could one of your merge this please? I'd love to get the reference to my fork out of my Gemfile and resolve this issue for anyone else who may be stumbling upon it.

Thanks!

@soopa
Copy link
Author

soopa commented Sep 25, 2013

Updated branch target in #41, closing this one.

@soopa soopa closed this Sep 25, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant