Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single nil object should be treated as nil #439

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sr189
Copy link

@sr189 sr189 commented Jun 5, 2018

In response to #350

Jbuilder is currently returning an empty array when using a partial with a single object association such as:

json.organisation @order.organisation, partial: 'organisations/organisation', as: :organisation

This behaviour was introduced by #148 in order to return an empty array in case a collection is return nil. However this behaviour leads to the fact that all nil values are rendered as an empty array even if the association does not represent a collection or the more precise collection argument is used.

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @pixeltrix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants